diff options
| author | Michael Wright <mikerite@lavabit.com> | 2022-06-05 07:28:28 +0200 |
|---|---|---|
| committer | Michael Wright <mikerite@lavabit.com> | 2022-06-05 07:30:59 +0200 |
| commit | a2de34720d984669499e981b640cde050c2a4dfa (patch) | |
| tree | bff5a53fade5f5083f7c6f51a5acd8876a76851e | |
| parent | 2a1a80d80cdc75ed0bb9f35744591089b8a89f31 (diff) | |
| download | rust-a2de34720d984669499e981b640cde050c2a4dfa.tar.gz rust-a2de34720d984669499e981b640cde050c2a4dfa.zip | |
needless_late_init refactoring
Remove the unneeded wrapping and unwrapping in suggestion creation. Collecting to Option<Vec<_>> only returns None if one of the elements is None and that is never the case here.
| -rw-r--r-- | clippy_lints/src/needless_late_init.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clippy_lints/src/needless_late_init.rs b/clippy_lints/src/needless_late_init.rs index 5e97c606e21..4154c71b428 100644 --- a/clippy_lints/src/needless_late_init.rs +++ b/clippy_lints/src/needless_late_init.rs @@ -191,8 +191,8 @@ fn assignment_suggestions<'tcx>( assignment.rhs_span.shrink_to_hi().with_hi(assignment.span.hi()), ] }) - .map(|span| Some((span, String::new()))) - .collect::<Option<Vec<(Span, String)>>>()?; + .map(|span| (span, String::new())) + .collect::<Vec<(Span, String)>>(); match suggestions.len() { // All of `exprs` are never types |
