Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eq_op should be allowed to optionally support function calls #13827

Open
klensy opened this issue Dec 14, 2024 · 1 comment · May be fixed by #13828
Open

eq_op should be allowed to optionally support function calls #13827

klensy opened this issue Dec 14, 2024 · 1 comment · May be fixed by #13828
Assignees
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't

Comments

@klensy
Copy link
Contributor

klensy commented Dec 14, 2024

Summary

Ability to check function calls was removed back in #230 and mentioned in description:

False negatives: We had some false positives regarding calls (notably [racer](https://github.com/phildawes/racer)
had one instance of x.pop() && x.pop()), so we removed matching any function or method calls.

and removed ability to actually catch few more bugs.

I agree, that by default it will emit false positives, so this added check should be allowed to turn on manually via lint configuration (https://doc.rust-lang.org/clippy/configuration.html#configuring-clippy).

There few bug examples that should be discoverable by clippy rust-lang/rust#134214 #13820 rust-lang/rustc_codegen_gcc#579

It isn't strictly FN issue, more like improvement suggestion.

Lint Name

eq_op

Reproducer

Well, it's expected to emit no warn as there currently no option to turn check for calls on.

I tried this code:

#![warn(clippy::eq_op)]

fn main() {
    let i0 = vec![1,2,3];
    let i1 = vec![4,5,6];
    if i0.last() == i0.last() {
        println!("nice");
    }
    println!("{i0:?}, {i1:?}");
}

I expected to see this happen:

warn about equal parts in i0.last() == i0.last()

Instead, this happened:

no warn

Version

rustc 1.85.0-nightly (6b6a867ae 2024-11-27)
binary: rustc
commit-hash: 6b6a867ae9eac4e78d041ac4ee84be1072a48cf7
commit-date: 2024-11-27
host: x86_64-pc-windows-msvc
release: 1.85.0-nightly
LLVM version: 19.1.4
@klensy klensy added C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't labels Dec 14, 2024
@klensy
Copy link
Contributor Author

klensy commented Dec 14, 2024

Will try @rustbot claim

@klensy klensy linked a pull request Dec 14, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant