-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingE-hardCall for participation: This a hard problem and requires more experience or effort to work onCall for participation: This a hard problem and requires more experience or effort to work onI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when appliedT-middleType: Probably requires verifiying typesType: Probably requires verifiying types
Description
Link to example: http://play.integer32.com/?gist=2d02b966174279055a9519a5f3182a7d&version=undefined
warning: called `.get().unwrap()` on a HashMap. Using `[]` is more clear and more concise
--> src/main.rs:24:9
|
24 | data.data.get(&key).unwrap().clone()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this `&data.data[&key]`
|
= note: #[warn(get_unwrap)] on by default
= help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#get_unwrap
Honestly seems like the suggested change should work but lifetimes seem to prevent it. Might be because Index
and get
take slightly different parameter types?
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingE-hardCall for participation: This a hard problem and requires more experience or effort to work onCall for participation: This a hard problem and requires more experience or effort to work onI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when appliedT-middleType: Probably requires verifiying typesType: Probably requires verifiying types