@@ -2,7 +2,9 @@ error: called `Option::take()` on a temporary value
22 --> tests/ui/needless_option_take.rs:23:5
33 |
44LL | x.as_ref().take();
5- | ^^^^^^^^^^^^^^^^^
5+ | ^^^^^^^^^^-------
6+ | |
7+ | help: remove
68 |
79 = note: `as_ref` creates a temporary value, so calling take() has no effect
810 = note: `-D clippy::needless-option-take` implied by `-D warnings`
@@ -12,63 +14,79 @@ error: called `Option::take()` on a temporary value
1214 --> tests/ui/needless_option_take.rs:31:13
1315 |
1416LL | let y = x.as_mut().take();
15- | ^^^^^^^^^^^^^^^^^
17+ | ^^^^^^^^^^-------
18+ | |
19+ | help: remove
1620 |
1721 = note: `as_mut` creates a temporary value, so calling take() has no effect
1822
1923error: called `Option::take()` on a temporary value
2024 --> tests/ui/needless_option_take.rs:33:13
2125 |
2226LL | let y = x.replace(289).take();
23- | ^^^^^^^^^^^^^^^^^^^^^
27+ | ^^^^^^^^^^^^^^-------
28+ | |
29+ | help: remove
2430 |
2531 = note: `replace` creates a temporary value, so calling take() has no effect
2632
2733error: called `Option::take()` on a temporary value
2834 --> tests/ui/needless_option_take.rs:36:13
2935 |
3036LL | let y = Some(3).as_mut().take();
31- | ^^^^^^^^^^^^^^^^^^^^^^^
37+ | ^^^^^^^^^^^^^^^^-------
38+ | |
39+ | help: remove
3240 |
3341 = note: `as_mut` creates a temporary value, so calling take() has no effect
3442
3543error: called `Option::take()` on a temporary value
3644 --> tests/ui/needless_option_take.rs:39:13
3745 |
3846LL | let y = Option::as_mut(&mut x).take();
39- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47+ | ^^^^^^^^^^^^^^^^^^^^^^-------
48+ | |
49+ | help: remove
4050 |
4151 = note: `as_mut` creates a temporary value, so calling take() has no effect
4252
4353error: called `Option::take()` on a temporary value
4454 --> tests/ui/needless_option_take.rs:43:13
4555 |
4656LL | let x = return_option().take();
47- | ^^^^^^^^^^^^^^^^^^^^^^
57+ | ^^^^^^^^^^^^^^^-------
58+ | |
59+ | help: remove
4860 |
4961 = note: `return_option` creates a temporary value, so calling take() has no effect
5062
5163error: called `Option::take()` on a temporary value
5264 --> tests/ui/needless_option_take.rs:47:13
5365 |
5466LL | let x = MyStruct::get_option().take();
55- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
67+ | ^^^^^^^^^^^^^^^^^^^^^^-------
68+ | |
69+ | help: remove
5670 |
5771 = note: `get_option` creates a temporary value, so calling take() has no effect
5872
5973error: called `Option::take()` on a temporary value
6074 --> tests/ui/needless_option_take.rs:53:13
6175 |
6276LL | let y = my_vec.first().take();
63- | ^^^^^^^^^^^^^^^^^^^^^
77+ | ^^^^^^^^^^^^^^-------
78+ | |
79+ | help: remove
6480 |
6581 = note: `first` creates a temporary value, so calling take() has no effect
6682
6783error: called `Option::take()` on a temporary value
6884 --> tests/ui/needless_option_take.rs:56:13
6985 |
7086LL | let y = my_vec.first().take();
71- | ^^^^^^^^^^^^^^^^^^^^^
87+ | ^^^^^^^^^^^^^^-------
88+ | |
89+ | help: remove
7290 |
7391 = note: `first` creates a temporary value, so calling take() has no effect
7492
0 commit comments