Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impl Show for Path? #15827

Closed
liigo opened this issue Jul 20, 2014 · 2 comments
Closed

impl Show for Path? #15827

liigo opened this issue Jul 20, 2014 · 2 comments

Comments

@liigo
Copy link
Contributor

liigo commented Jul 20, 2014

Path does not impl Show currently.
Sometimes you can't simply use Path.display(), for example:

let path = Some(Path::new("/home/liigo"));
println!("{}", path); // error: failed to find an implementation of trait core::fmt::Show for std::path::windows::Path
@liigo liigo changed the title impl Show for Path impl Show for Path? Jul 20, 2014
@huonw
Copy link
Member

huonw commented Jul 20, 2014

This is by design, a Path cannot be shown without risking losing information, so you should think twice before rendering a Path to a string: http://stackoverflow.com/a/24061240/1256624

Your example can be rendered with path.as_ref().map(|p| p.display()). http://is.gd/LP623L

(Closing as not a bug.)

@huonw huonw closed this as completed Jul 20, 2014
@liigo
Copy link
Contributor Author

liigo commented Jul 20, 2014

I known this is by design, but I don't known what it resolved by this
design. By using Path::display, you risking losing information too, the
risk just transfer from show to display.
2014年7月20日 下午8:42于 "Huon Wilson" notifications@github.com写道:

This is by design, a Path cannot be shown without risking losing
information, so you should think twice before rendering a Path to a string:
http://stackoverflow.com/a/24061240/1256624

Your example can be rendered with path.as_ref().map(|p| p.display()).
http://is.gd/LP623L

(Closing as not a bug.)


Reply to this email directly or view it on GitHub.

bors added a commit to rust-lang-ci/rust that referenced this issue Nov 13, 2023
…cola

VSCode metadata. category:formatters

If you invoke cmd+p `Format Document` without rust-analyzer installed in the workspace, VSCode suggests you "install a formatter" which triggers a search for `category:formatters rust`. Sadly rust-analyzer extension is not suggested.

Tweak VSCode Extension Metadata so rust-analyzer shows up in 'category:formatters rust' search.

You can see the valid values for categories in the [extension manifest: field reference](https://code.visualstudio.com/api/references/extension-manifest#fields) docs.

<img width="270" alt="search2" src="https://github.com/rust-lang/rust-analyzer/assets/145113/5bd86497-2450-4be4-a073-e134d0616226">
<img width="432" alt="search_1" src="https://github.com/rust-lang/rust-analyzer/assets/145113/1ad1b375-58a1-4b37-b485-78e2a26b8342">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants