blob: 9054463c07cd22f855ed061d762cb71202b84089 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
error: called `Option::take()` on a temporary value
--> tests/ui/needless_option_take.rs:23:5
|
LL | x.as_ref().take();
| ^^^^^^^^^^-------
| |
| help: remove
|
= note: `as_ref` creates a temporary value, so calling take() has no effect
= note: `-D clippy::needless-option-take` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::needless_option_take)]`
error: called `Option::take()` on a temporary value
--> tests/ui/needless_option_take.rs:31:13
|
LL | let y = x.as_mut().take();
| ^^^^^^^^^^-------
| |
| help: remove
|
= note: `as_mut` creates a temporary value, so calling take() has no effect
error: called `Option::take()` on a temporary value
--> tests/ui/needless_option_take.rs:34:13
|
LL | let y = x.replace(289).take();
| ^^^^^^^^^^^^^^-------
| |
| help: remove
|
= note: `replace` creates a temporary value, so calling take() has no effect
error: called `Option::take()` on a temporary value
--> tests/ui/needless_option_take.rs:37:13
|
LL | let y = Some(3).as_mut().take();
| ^^^^^^^^^^^^^^^^-------
| |
| help: remove
|
= note: `as_mut` creates a temporary value, so calling take() has no effect
error: called `Option::take()` on a temporary value
--> tests/ui/needless_option_take.rs:40:13
|
LL | let y = Option::as_mut(&mut x).take();
| ^^^^^^^^^^^^^^^^^^^^^^-------
| |
| help: remove
|
= note: `as_mut` creates a temporary value, so calling take() has no effect
error: called `Option::take()` on a temporary value
--> tests/ui/needless_option_take.rs:44:13
|
LL | let x = return_option().take();
| ^^^^^^^^^^^^^^^-------
| |
| help: remove
|
= note: `return_option` creates a temporary value, so calling take() has no effect
error: called `Option::take()` on a temporary value
--> tests/ui/needless_option_take.rs:48:13
|
LL | let x = MyStruct::get_option().take();
| ^^^^^^^^^^^^^^^^^^^^^^-------
| |
| help: remove
|
= note: `get_option` creates a temporary value, so calling take() has no effect
error: called `Option::take()` on a temporary value
--> tests/ui/needless_option_take.rs:54:13
|
LL | let y = my_vec.first().take();
| ^^^^^^^^^^^^^^-------
| |
| help: remove
|
= note: `first` creates a temporary value, so calling take() has no effect
error: called `Option::take()` on a temporary value
--> tests/ui/needless_option_take.rs:57:13
|
LL | let y = my_vec.first().take();
| ^^^^^^^^^^^^^^-------
| |
| help: remove
|
= note: `first` creates a temporary value, so calling take() has no effect
error: aborting due to 9 previous errors
|