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

unwrap-used not triggering for DashMap #8399

Closed
Tracked by #79
laralove143 opened this issue Feb 6, 2022 · 6 comments
Closed
Tracked by #79

unwrap-used not triggering for DashMap #8399

laralove143 opened this issue Feb 6, 2022 · 6 comments
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

@laralove143
Copy link

Summary

this code works as expected

let mut hm = HashMap::new();
hm.insert("foo", "bar");
hm.get("foo").unwrap();

but

let dm = DashMap::new();
dm.insert("foo", "bar");
dm.get("foo").unwrap();

does not trigger any lint

Lint Name

unwrap-used

Reproducer

I tried this code:

let dm = DashMap::new();
dm.insert("foo", "bar");
dm.get("foo").unwrap();

I expected to see this happen:
clippy::unwrap-used triggers
Instead, this happened:
nothing

Version

rustc 1.58.1 (db9d1b20b 2022-01-20)
binary: rustc
commit-hash: db9d1b20bba1968c1ec1fc49616d4742c1725b4b
commit-date: 2022-01-20
host: aarch64-apple-darwin
release: 1.58.1
LLVM version: 13.0.0
@laralove143 laralove143 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 Feb 6, 2022
@giraffate
Copy link
Contributor

The unwrap_used didn't trigger for get() or get_mut(), but it will be fixed in #8124.

@laralove143
Copy link
Author

that seems different, like i said in the comment it works as expected with vecs and hashmaps

@giraffate
Copy link
Contributor

Hm, at least for now, clippy doesn't seem to trigger the unwrap_used lint for HashMap. Do I get that right?
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=5ba51b74b72a57a8a6150538936fe690

@laralove143
Copy link
Author

yeah but it triggers get_unwrap so it’s fine, except DashMap doesn’t implement Index so with any other similar case it’d be a problem. i wonder why this acts different than any other unwraps

@laralove143
Copy link
Author

is there any updates on this?

@sgued
Copy link
Contributor

sgued commented Aug 13, 2022

Should this still be open? I can't reproduce it with any clippy version > 1.60

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

No branches or pull requests

3 participants