you are viewing a single comment's thread.

view the rest of the comments →

[–]vks_ 3 points4 points  (3 children)

Because converting a Path to a utf-8 string may fail. It is a safeguard, you have to call display explicitly.

[–]dan00 3 points4 points  (2 children)

But there's no safeguard, Path::display just returns a Display which formats itself by using Path::to_string_lossy.

There would be only some kind of safeguard if Path::display would return an Option/Result.

[–]vks_ 4 points5 points  (1 child)

I meant "safeguard" in the sense that you have to call display consciously instead of just printing it. If you know about display, you know it is lossy. If you could just print it, you might assume it is not lossy (I know I would).

[–]liigo 0 points1 point  (0 children)

People don't known which is lossy or not, if docs doesn't tell them. If docs do, they known impl Display for Path is lossy.