mirror of
https://github.com/uutils/coreutils.git
synced 2025-12-23 08:47:37 +00:00
clippy: fix warnings from manual_let_else lint
This commit is contained in:
parent
49e4eba078
commit
454bdcb039
2 changed files with 13 additions and 17 deletions
|
|
@ -198,20 +198,17 @@ impl Params {
|
|||
// Get the start and end indices of the randomized part of the template.
|
||||
//
|
||||
// For example, if the template is "abcXXXXyz", then `i` is 3 and `j` is 7.
|
||||
let (i, j) = match find_last_contiguous_block_of_xs(&options.template) {
|
||||
None => {
|
||||
let s = match options.suffix {
|
||||
// If a suffix is specified, the error message includes the template without the suffix.
|
||||
Some(_) => options
|
||||
.template
|
||||
.chars()
|
||||
.take(options.template.len())
|
||||
.collect::<String>(),
|
||||
None => options.template,
|
||||
};
|
||||
return Err(MkTempError::TooFewXs(s));
|
||||
}
|
||||
Some(indices) => indices,
|
||||
let Some((i, j)) = find_last_contiguous_block_of_xs(&options.template) else {
|
||||
let s = match options.suffix {
|
||||
// If a suffix is specified, the error message includes the template without the suffix.
|
||||
Some(_) => options
|
||||
.template
|
||||
.chars()
|
||||
.take(options.template.len())
|
||||
.collect::<String>(),
|
||||
None => options.template,
|
||||
};
|
||||
return Err(MkTempError::TooFewXs(s));
|
||||
};
|
||||
|
||||
// Combine the directory given as an option and the prefix of the template.
|
||||
|
|
|
|||
|
|
@ -143,9 +143,8 @@ fn find_stdout() -> UResult<File> {
|
|||
Ok(t)
|
||||
}
|
||||
Err(e1) => {
|
||||
let home = match env::var("HOME") {
|
||||
Err(_) => return Err(NohupError::OpenFailed(internal_failure_code, e1).into()),
|
||||
Ok(h) => h,
|
||||
let Ok(home) = env::var("HOME") else {
|
||||
return Err(NohupError::OpenFailed(internal_failure_code, e1).into());
|
||||
};
|
||||
let mut homeout = PathBuf::from(home);
|
||||
homeout.push(NOHUP_OUT);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue