mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
tests ~ fix cargo clippy
complaint (*allow* clippy::manual_strip; with FixME/ToDO)
- replace with the included/noted code when MSRV includes a stabilized `String::strip_prefix()`
This commit is contained in:
parent
3f0ac06122
commit
7df5acc2dc
1 changed files with 9 additions and 0 deletions
|
@ -625,11 +625,20 @@ impl AtPath {
|
||||||
// Source:
|
// Source:
|
||||||
// http://stackoverflow.com/questions/31439011/getfinalpathnamebyhandle-without-prepended
|
// http://stackoverflow.com/questions/31439011/getfinalpathnamebyhandle-without-prepended
|
||||||
let prefix = "\\\\?\\";
|
let prefix = "\\\\?\\";
|
||||||
|
// FixME: replace ...
|
||||||
|
#[allow(clippy::manual_strip)]
|
||||||
if s.starts_with(prefix) {
|
if s.starts_with(prefix) {
|
||||||
String::from(&s[prefix.len()..])
|
String::from(&s[prefix.len()..])
|
||||||
} else {
|
} else {
|
||||||
s
|
s
|
||||||
}
|
}
|
||||||
|
// ... with ...
|
||||||
|
// if let Some(stripped) = s.strip_prefix(prefix) {
|
||||||
|
// String::from(stripped)
|
||||||
|
// } else {
|
||||||
|
// s
|
||||||
|
// }
|
||||||
|
// ... when using MSRV with stabilized `strip_prefix()`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue