Skip to content

Commit 454bdcb

Browse files
committed
clippy: fix warnings from manual_let_else lint
1 parent 49e4eba commit 454bdcb

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

src/uu/mktemp/src/mktemp.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -198,20 +198,17 @@ impl Params {
198198
// Get the start and end indices of the randomized part of the template.
199199
//
200200
// For example, if the template is "abcXXXXyz", then `i` is 3 and `j` is 7.
201-
let (i, j) = match find_last_contiguous_block_of_xs(&options.template) {
202-
None => {
203-
let s = match options.suffix {
204-
// If a suffix is specified, the error message includes the template without the suffix.
205-
Some(_) => options
206-
.template
207-
.chars()
208-
.take(options.template.len())
209-
.collect::<String>(),
210-
None => options.template,
211-
};
212-
return Err(MkTempError::TooFewXs(s));
213-
}
214-
Some(indices) => indices,
201+
let Some((i, j)) = find_last_contiguous_block_of_xs(&options.template) else {
202+
let s = match options.suffix {
203+
// If a suffix is specified, the error message includes the template without the suffix.
204+
Some(_) => options
205+
.template
206+
.chars()
207+
.take(options.template.len())
208+
.collect::<String>(),
209+
None => options.template,
210+
};
211+
return Err(MkTempError::TooFewXs(s));
215212
};
216213

217214
// Combine the directory given as an option and the prefix of the template.

src/uu/nohup/src/nohup.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,8 @@ fn find_stdout() -> UResult<File> {
143143
Ok(t)
144144
}
145145
Err(e1) => {
146-
let home = match env::var("HOME") {
147-
Err(_) => return Err(NohupError::OpenFailed(internal_failure_code, e1).into()),
148-
Ok(h) => h,
146+
let Ok(home) = env::var("HOME") else {
147+
return Err(NohupError::OpenFailed(internal_failure_code, e1).into());
149148
};
150149
let mut homeout = PathBuf::from(home);
151150
homeout.push(NOHUP_OUT);

0 commit comments

Comments
 (0)