Skip to content

unwrap_used not triggered when chained from get() or get_mut() #8124

Closed
@doy

Description

@doy

Summary

it appears that the unwrap_used lint does not trigger for code of the form foo.get(i).unwrap() or foo.get_mut(i).unwrap()

Lint Name

unwrap_used

Reproducer

I tried this code:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=2ed9ce35f88fd2d4c16151aeed566134

I expected to see this happen:

all three functions should trigger the unwrap_used lint

Instead, this happened:
the second function does not trigger the lint

Version

rustc 1.57.0 (f1edd0429 2021-11-29)
binary: rustc
commit-hash: f1edd0429582dd29cccacaf50fd134b05593bd9c
commit-date: 2021-11-29
host: x86_64-unknown-linux-gnu
release: 1.57.0
LLVM version: 13.0.0

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tgood first issueThese issues are a good way to get started with Clippy

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions