Skip to content

Commit 26df273

Browse files
ojedajfvogel
authored andcommitted
rust: enable clippy::ignored_unit_patterns lint
commit 3fcc233 upstream. In Rust 1.73.0, Clippy introduced the `ignored_unit_patterns` lint [1]: > Matching with `()` explicitly instead of `_` outlines the fact that > the pattern contains no data. Also it would detect a type change > that `_` would ignore. There is only a single case that requires a change: error: matching over `()` is more explicit --> rust/kernel/types.rs:176:45 | 176 | ScopeGuard::new_with_data((), move |_| cleanup()) | ^ help: use `()` instead of `_`: `()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns = note: requested on the command line with `-D clippy::ignored-unit-patterns` Thus clean it up and enable the lint -- no functional change intended. Link: https://rust-lang.github.io/rust-clippy/master/index.html#/ignored_unit_patterns [1] Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Trevor Gross <[email protected]> Tested-by: Gary Guo <[email protected]> Reviewed-by: Gary Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit c6447d4d83f577132ed267332c860ff9b5332652) Signed-off-by: Jack Vogel <[email protected]>
1 parent 8d7506e commit 26df273

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ export rust_common_flags := --edition=2021 \
455455
-Wunreachable_pub \
456456
-Wclippy::all \
457457
-Wclippy::dbg_macro \
458+
-Wclippy::ignored_unit_patterns \
458459
-Wclippy::mut_mut \
459460
-Wclippy::needless_bitwise_bool \
460461
-Wclippy::needless_continue \

rust/kernel/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl<T, F: FnOnce(T)> ScopeGuard<T, F> {
225225
impl ScopeGuard<(), fn(())> {
226226
/// Creates a new guarded object with the given cleanup function.
227227
pub fn new(cleanup: impl FnOnce()) -> ScopeGuard<(), impl FnOnce(())> {
228-
ScopeGuard::new_with_data((), move |_| cleanup())
228+
ScopeGuard::new_with_data((), move |()| cleanup())
229229
}
230230
}
231231

0 commit comments

Comments
 (0)