Merge pull request #386 from cakebaker/clippy_fix_warnings_from_rust_1_86

clippy: fix warnings from Rust 1.86
This commit is contained in:
Krysztal Huang
2025-04-04 17:40:15 +08:00
committed by GitHub
5 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -79,7 +79,7 @@ impl TryFrom<PathBuf> for Teletype {
let f = |prefix: &str| {
value
.iter()
.last()?
.next_back()?
.to_str()?
.strip_prefix(prefix)?
.parse::<u64>()
@@ -229,7 +229,7 @@ impl ProcessInformation {
let pid = {
value
.iter()
.last()
.next_back()
.ok_or(io::ErrorKind::Other)?
.to_str()
.ok_or(io::ErrorKind::InvalidData)?
+1 -1
View File
@@ -213,7 +213,7 @@ fn construct_verbose_result(pids: &[u32], action_results: &[Option<ActionResult>
let mut cmd = process
.exe()
.and_then(|it| it.iter().last())
.and_then(|it| it.iter().next_back())
.unwrap_or("?".as_ref());
let cmd = cmd.to_str().unwrap();
+1 -1
View File
@@ -193,7 +193,7 @@ fn command(pid: u32) -> String {
};
proc.exe()
.and_then(|it| it.iter().last())
.and_then(|it| it.iter().next_back())
.map(|it| it.to_str().unwrap())
.unwrap_or(&f(proc.cmd()))
.into()
+1 -1
View File
@@ -154,7 +154,7 @@ where
input.chars().take(width).collect()
} else {
let mut result = String::from(&input);
result.extend(std::iter::repeat(' ').take(width - input.len()));
result.extend(std::iter::repeat_n(' ', width - input.len()));
result
}
}
+2 -2
View File
@@ -1186,9 +1186,9 @@ impl TestScenario {
/// A `UCommand` is a builder wrapping an individual Command that provides several additional features:
/// 1. it has convenience functions that are more ergonomic to use for piping in stdin, spawning the command
/// and asserting on the results.
/// and asserting on the results.
/// 2. it tracks arguments provided so that in test cases which may provide variations of an arg in loops
/// the test failure can display the exact call which preceded an assertion failure.
/// the test failure can display the exact call which preceded an assertion failure.
/// 3. it provides convenience construction methods to set the Command uutils utility and temporary directory.
///
/// Per default `UCommand` runs a command given as an argument in a shell, platform independently.