Skip to content

len_without_is_empty doesn't fire in 1.82 #13555

@eric-seppanen

Description

@eric-seppanen

Summary

In rust 1.81, the following code triggers the clippy::len_without_is_empty lint. However in the current 1.82 beta, the lint no longer fires. I haven't found any changes that would account for this, and the documentation says this lint is still warn by default.

pub struct Empty; impl Empty { pub fn len(&self) -> usize { 0 } }

rust 1.81:

warning: struct `Empty` has a public `len` method, but no `is_empty` method --> src/lib.rs:9:5 | 9 | pub fn len(&self) -> usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty = note: `#[warn(clippy::len_without_is_empty)]` on by default 

rust 1.82:
(no lint output)

Reproducer

(See above)

Version

rustc 1.82.0-beta.6 (763ad520c 2024-10-12)
binary: rustc
commit-hash: 763ad520cc6b831ec98e20f8a8fe85b160ad859d
commit-date: 2024-10-12
host: x86_64-unknown-linux-gnu
release: 1.82.0-beta.6
LLVM version: 19.1.1

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions