Clippy fixes from stable and nightly (#13455)

- **Doccomment style fixes**
- **Forgotten stuff in `nu-pretty-hex`**
- **Don't `for` around an `Option`**
- and more

I think the suggestions here are a net positive, some of the suggestions
moved into #13498 feel somewhat arbitrary, I also raised
https://github.com/rust-lang/rust-clippy/issues/13188 as the nightly
`byte_char_slices` would require either a global allow or otherwise a
ton of granular allows or possibly confusing bytestring literals.
This commit is contained in:
Stefan Holderbach
2024-07-31 20:37:40 +02:00
committed by GitHub
parent 928c57db41
commit 42531e017c
15 changed files with 185 additions and 240 deletions

View File

@ -660,10 +660,10 @@ impl Path {
/// the current directory.
///
/// * On Unix, a path is absolute if it starts with the root,
/// so [`is_absolute`](Path::is_absolute) and [`has_root`](Path::has_root) are equivalent.
/// so [`is_absolute`](Path::is_absolute) and [`has_root`](Path::has_root) are equivalent.
///
/// * On Windows, a path is absolute if it has a prefix and starts with the root:
/// `c:\windows` is absolute, while `c:temp` and `\temp` are not.
/// `c:\windows` is absolute, while `c:temp` and `\temp` are not.
///
/// # Examples
///

View File

@ -121,7 +121,7 @@ fn expand_tilde_with_another_user_home(path: &Path) -> PathBuf {
return match path.to_str() {
Some(file_path) => {
let mut file = file_path.to_string();
match file_path.find(|c| c == '/' || c == '\\') {
match file_path.find(['/', '\\']) {
None => {
file.remove(0);
user_home_dir(&file)