add attributes
This commit is contained in:
parent
df6ef6059b
commit
447ed5ce52
3 changed files with 29 additions and 53 deletions
|
|
@ -39,6 +39,7 @@ fn main() {
|
|||
let _ = &some_vecdeque[0];
|
||||
let _ = &some_hashmap[&1];
|
||||
let _ = &some_btreemap[&1];
|
||||
#[allow(clippy::unwrap_used)]
|
||||
let _ = false_positive.get(0).unwrap();
|
||||
// Test with deref
|
||||
let _: u8 = boxed_slice[1];
|
||||
|
|
@ -51,9 +52,12 @@ fn main() {
|
|||
some_vec[0] = 1;
|
||||
some_vecdeque[0] = 1;
|
||||
// Check false positives
|
||||
*some_hashmap.get_mut(&1).unwrap() = 'b';
|
||||
*some_btreemap.get_mut(&1).unwrap() = 'b';
|
||||
*false_positive.get_mut(0).unwrap() = 1;
|
||||
#[allow(clippy::unwrap_used)]
|
||||
{
|
||||
*some_hashmap.get_mut(&1).unwrap() = 'b';
|
||||
*some_btreemap.get_mut(&1).unwrap() = 'b';
|
||||
*false_positive.get_mut(0).unwrap() = 1;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ fn main() {
|
|||
let _ = some_vecdeque.get(0).unwrap();
|
||||
let _ = some_hashmap.get(&1).unwrap();
|
||||
let _ = some_btreemap.get(&1).unwrap();
|
||||
#[allow(clippy::unwrap_used)]
|
||||
let _ = false_positive.get(0).unwrap();
|
||||
// Test with deref
|
||||
let _: u8 = *boxed_slice.get(1).unwrap();
|
||||
|
|
@ -51,9 +52,12 @@ fn main() {
|
|||
*some_vec.get_mut(0).unwrap() = 1;
|
||||
*some_vecdeque.get_mut(0).unwrap() = 1;
|
||||
// Check false positives
|
||||
*some_hashmap.get_mut(&1).unwrap() = 'b';
|
||||
*some_btreemap.get_mut(&1).unwrap() = 'b';
|
||||
*false_positive.get_mut(0).unwrap() = 1;
|
||||
#[allow(clippy::unwrap_used)]
|
||||
{
|
||||
*some_hashmap.get_mut(&1).unwrap() = 'b';
|
||||
*some_btreemap.get_mut(&1).unwrap() = 'b';
|
||||
*false_positive.get_mut(0).unwrap() = 1;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -89,22 +89,14 @@ LL | let _ = some_btreemap.get(&1).unwrap();
|
|||
|
|
||||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: used `unwrap()` on `an Option` value
|
||||
--> $DIR/get_unwrap.rs:42:17
|
||||
|
|
||||
LL | let _ = false_positive.get(0).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:44:21
|
||||
--> $DIR/get_unwrap.rs:45:21
|
||||
|
|
||||
LL | let _: u8 = *boxed_slice.get(1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `boxed_slice[1]`
|
||||
|
||||
error: used `unwrap()` on `an Option` value
|
||||
--> $DIR/get_unwrap.rs:44:22
|
||||
--> $DIR/get_unwrap.rs:45:22
|
||||
|
|
||||
LL | let _: u8 = *boxed_slice.get(1).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -112,13 +104,13 @@ LL | let _: u8 = *boxed_slice.get(1).unwrap();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:49:9
|
||||
--> $DIR/get_unwrap.rs:50:9
|
||||
|
|
||||
LL | *boxed_slice.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `boxed_slice[0]`
|
||||
|
||||
error: used `unwrap()` on `an Option` value
|
||||
--> $DIR/get_unwrap.rs:49:10
|
||||
--> $DIR/get_unwrap.rs:50:10
|
||||
|
|
||||
LL | *boxed_slice.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -126,13 +118,13 @@ LL | *boxed_slice.get_mut(0).unwrap() = 1;
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a slice. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:50:9
|
||||
--> $DIR/get_unwrap.rs:51:9
|
||||
|
|
||||
LL | *some_slice.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_slice[0]`
|
||||
|
||||
error: used `unwrap()` on `an Option` value
|
||||
--> $DIR/get_unwrap.rs:50:10
|
||||
--> $DIR/get_unwrap.rs:51:10
|
||||
|
|
||||
LL | *some_slice.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -140,13 +132,13 @@ LL | *some_slice.get_mut(0).unwrap() = 1;
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:51:9
|
||||
--> $DIR/get_unwrap.rs:52:9
|
||||
|
|
||||
LL | *some_vec.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0]`
|
||||
|
||||
error: used `unwrap()` on `an Option` value
|
||||
--> $DIR/get_unwrap.rs:51:10
|
||||
--> $DIR/get_unwrap.rs:52:10
|
||||
|
|
||||
LL | *some_vec.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -154,51 +146,27 @@ LL | *some_vec.get_mut(0).unwrap() = 1;
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a VecDeque. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:52:9
|
||||
--> $DIR/get_unwrap.rs:53:9
|
||||
|
|
||||
LL | *some_vecdeque.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vecdeque[0]`
|
||||
|
||||
error: used `unwrap()` on `an Option` value
|
||||
--> $DIR/get_unwrap.rs:52:10
|
||||
--> $DIR/get_unwrap.rs:53:10
|
||||
|
|
||||
LL | *some_vecdeque.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: used `unwrap()` on `an Option` value
|
||||
--> $DIR/get_unwrap.rs:54:10
|
||||
|
|
||||
LL | *some_hashmap.get_mut(&1).unwrap() = 'b';
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: used `unwrap()` on `an Option` value
|
||||
--> $DIR/get_unwrap.rs:55:10
|
||||
|
|
||||
LL | *some_btreemap.get_mut(&1).unwrap() = 'b';
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: used `unwrap()` on `an Option` value
|
||||
--> $DIR/get_unwrap.rs:56:10
|
||||
|
|
||||
LL | *false_positive.get_mut(0).unwrap() = 1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get().unwrap()` on a Vec. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:61:17
|
||||
--> $DIR/get_unwrap.rs:65:17
|
||||
|
|
||||
LL | let _ = some_vec.get(0..1).unwrap().to_vec();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0..1]`
|
||||
|
||||
error: used `unwrap()` on `an Option` value
|
||||
--> $DIR/get_unwrap.rs:61:17
|
||||
--> $DIR/get_unwrap.rs:65:17
|
||||
|
|
||||
LL | let _ = some_vec.get(0..1).unwrap().to_vec();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
@ -206,18 +174,18 @@ LL | let _ = some_vec.get(0..1).unwrap().to_vec();
|
|||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: called `.get_mut().unwrap()` on a Vec. Using `[]` is more clear and more concise
|
||||
--> $DIR/get_unwrap.rs:62:17
|
||||
--> $DIR/get_unwrap.rs:66:17
|
||||
|
|
||||
LL | let _ = some_vec.get_mut(0..1).unwrap().to_vec();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `some_vec[0..1]`
|
||||
|
||||
error: used `unwrap()` on `an Option` value
|
||||
--> $DIR/get_unwrap.rs:62:17
|
||||
--> $DIR/get_unwrap.rs:66:17
|
||||
|
|
||||
LL | let _ = some_vec.get_mut(0..1).unwrap().to_vec();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: if you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
|
||||
error: aborting due to 30 previous errors
|
||||
error: aborting due to 26 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue