Skip to content

Forbid use of Path::display, require display_lossy instead

Ian Jackson requested to merge Diziet/arti:display into main

std::Path::display is a footgun. The docs do say it's lossy but that's not very prominent and not represented in the name (unlike in eg OsStr::to_string_lossy).

!2012 (merged) fixed a bug; one aspect of the code was that Path::display was used when it shouldn't have been. Working on this MR I discovered one more such (albeit unlikely to be triggered in practice).

So: forbid Path::display and provide, effectively, an alias display_lossy, with some clear explanation. This should discourage inappropriate use.

Merge request reports