Skip to content

Commit 2adc866

Browse files
committed
rust: allow clippy::collapsible_if globally
Similar to `clippy::collapsible_match` (globally allowed in the previous commit), the `clippy::collapsible_if` lint [1] can make code harder to read in certain cases. Thus just let developers decide on their own. In addition, remove the existing `expect` we had. Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is pinned in older LTSs). Suggested-by: Gary Guo <gary@garyguo.net> Link: https://lore.kernel.org/rust-for-linux/DGROP5CHU1QZ.1OKJRAUZXE9WC@garyguo.net/ Link: https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [1] Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://patch.msgid.link/20260426144201.227108-2-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent 838d852 commit 2adc866

2 files changed

Lines changed: 1 addition & 1 deletion

File tree

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ export rust_common_flags := --edition=2021 \
486486
-Wclippy::as_ptr_cast_mut \
487487
-Wclippy::as_underscore \
488488
-Wclippy::cast_lossless \
489+
-Aclippy::collapsible_if \
489490
-Aclippy::collapsible_match \
490491
-Wclippy::ignored_unit_patterns \
491492
-Aclippy::incompatible_msrv \

drivers/android/binder/range_alloc/array.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ impl<T> ArrayRangeAllocator<T> {
204204
// caller will mark them as unused, which means that they can be freed if the system comes
205205
// under memory pressure.
206206
let mut freed_range = FreedRange::interior_pages(offset, size);
207-
#[expect(clippy::collapsible_if)] // reads better like this
208207
if offset % PAGE_SIZE != 0 {
209208
if i == 0 || self.ranges[i - 1].endpoint() <= (offset & PAGE_MASK) {
210209
freed_range.start_page_idx -= 1;

0 commit comments

Comments
 (0)