You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: tests/ui/option_as_ref_deref.stderr
+16-16
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
-
error: called `.as_ref().map(Deref::deref)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `opt.clone().as_deref()` instead
1
+
error: called `.as_ref().map(Deref::deref)` on an Option value. This can be done more directly by calling `opt.clone().as_deref()` instead
2
2
--> $DIR/option_as_ref_deref.rs:13:13
3
3
|
4
4
LL | let _ = opt.clone().as_ref().map(Deref::deref).map(str::len);
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.clone().as_deref()`
6
6
|
7
7
= note: `-D clippy::option-as-ref-deref` implied by `-D warnings`
8
8
9
-
error: called `.as_ref().map(Deref::deref)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `opt.clone().as_deref()` instead
9
+
error: called `.as_ref().map(Deref::deref)` on an Option value. This can be done more directly by calling `opt.clone().as_deref()` instead
10
10
--> $DIR/option_as_ref_deref.rs:16:13
11
11
|
12
12
LL | let _ = opt.clone()
@@ -16,85 +16,85 @@ LL | | Deref::deref
16
16
LL | | )
17
17
| |_________^ help: try using as_deref instead: `opt.clone().as_deref()`
18
18
19
-
error: called `.as_mut().map(DerefMut::deref_mut)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `opt.as_deref_mut()` instead
19
+
error: called `.as_mut().map(DerefMut::deref_mut)` on an Option value. This can be done more directly by calling `opt.as_deref_mut()` instead
20
20
--> $DIR/option_as_ref_deref.rs:22:13
21
21
|
22
22
LL | let _ = opt.as_mut().map(DerefMut::deref_mut);
23
23
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
24
24
25
-
error: called `.as_ref().map(Deref::deref)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `opt.as_deref()` instead
25
+
error: called `.as_ref().map(String::as_str)` on an Option value. This can be done more directly by calling `opt.as_deref()` instead
26
26
--> $DIR/option_as_ref_deref.rs:24:13
27
27
|
28
28
LL | let _ = opt.as_ref().map(String::as_str);
29
29
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
30
30
31
-
error: called `.as_ref().map(Deref::deref)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `opt.as_deref()` instead
31
+
error: called `.as_ref().map(|x| x.as_str())` on an Option value. This can be done more directly by calling `opt.as_deref()` instead
32
32
--> $DIR/option_as_ref_deref.rs:25:13
33
33
|
34
34
LL | let _ = opt.as_ref().map(|x| x.as_str());
35
35
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
36
36
37
-
error: called `.as_mut().map(DerefMut::deref_mut)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `opt.as_deref_mut()` instead
37
+
error: called `.as_mut().map(String::as_mut_str)` on an Option value. This can be done more directly by calling `opt.as_deref_mut()` instead
38
38
--> $DIR/option_as_ref_deref.rs:26:13
39
39
|
40
40
LL | let _ = opt.as_mut().map(String::as_mut_str);
41
41
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
42
42
43
-
error: called `.as_mut().map(DerefMut::deref_mut)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `opt.as_deref_mut()` instead
43
+
error: called `.as_mut().map(|x| x.as_mut_str())` on an Option value. This can be done more directly by calling `opt.as_deref_mut()` instead
44
44
--> $DIR/option_as_ref_deref.rs:27:13
45
45
|
46
46
LL | let _ = opt.as_mut().map(|x| x.as_mut_str());
47
47
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
48
48
49
-
error: called `.as_ref().map(Deref::deref)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `Some(CString::new(vec![]).unwrap()).as_deref()` instead
49
+
error: called `.as_ref().map(CString::as_c_str)` on an Option value. This can be done more directly by calling `Some(CString::new(vec![]).unwrap()).as_deref()` instead
50
50
--> $DIR/option_as_ref_deref.rs:28:13
51
51
|
52
52
LL | let _ = Some(CString::new(vec![]).unwrap()).as_ref().map(CString::as_c_str);
53
53
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(CString::new(vec![]).unwrap()).as_deref()`
54
54
55
-
error: called `.as_ref().map(Deref::deref)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `Some(OsString::new()).as_deref()` instead
55
+
error: called `.as_ref().map(OsString::as_os_str)` on an Option value. This can be done more directly by calling `Some(OsString::new()).as_deref()` instead
56
56
--> $DIR/option_as_ref_deref.rs:29:13
57
57
|
58
58
LL | let _ = Some(OsString::new()).as_ref().map(OsString::as_os_str);
59
59
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(OsString::new()).as_deref()`
60
60
61
-
error: called `.as_ref().map(Deref::deref)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `Some(PathBuf::new()).as_deref()` instead
61
+
error: called `.as_ref().map(PathBuf::as_path)` on an Option value. This can be done more directly by calling `Some(PathBuf::new()).as_deref()` instead
62
62
--> $DIR/option_as_ref_deref.rs:30:13
63
63
|
64
64
LL | let _ = Some(PathBuf::new()).as_ref().map(PathBuf::as_path);
65
65
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(PathBuf::new()).as_deref()`
66
66
67
-
error: called `.as_ref().map(Deref::deref)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `Some(Vec::<()>::new()).as_deref()` instead
67
+
error: called `.as_ref().map(Vec::as_slice)` on an Option value. This can be done more directly by calling `Some(Vec::<()>::new()).as_deref()` instead
68
68
--> $DIR/option_as_ref_deref.rs:31:13
69
69
|
70
70
LL | let _ = Some(Vec::<()>::new()).as_ref().map(Vec::as_slice);
71
71
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(Vec::<()>::new()).as_deref()`
72
72
73
-
error: called `.as_mut().map(DerefMut::deref_mut)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `Some(Vec::<()>::new()).as_deref_mut()` instead
73
+
error: called `.as_mut().map(Vec::as_mut_slice)` on an Option value. This can be done more directly by calling `Some(Vec::<()>::new()).as_deref_mut()` instead
74
74
--> $DIR/option_as_ref_deref.rs:32:13
75
75
|
76
76
LL | let _ = Some(Vec::<()>::new()).as_mut().map(Vec::as_mut_slice);
77
77
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `Some(Vec::<()>::new()).as_deref_mut()`
78
78
79
-
error: called `.as_ref().map(Deref::deref)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `opt.as_deref()` instead
79
+
error: called `.as_ref().map(|x| x.deref())` on an Option value. This can be done more directly by calling `opt.as_deref()` instead
80
80
--> $DIR/option_as_ref_deref.rs:34:13
81
81
|
82
82
LL | let _ = opt.as_ref().map(|x| x.deref());
83
83
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
84
84
85
-
error: called `.as_mut().map(DerefMut::deref_mut)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `opt.clone().as_deref_mut()` instead
85
+
error: called `.as_mut().map(|x| x.deref_mut())` on an Option value. This can be done more directly by calling `opt.clone().as_deref_mut()` instead
86
86
--> $DIR/option_as_ref_deref.rs:35:13
87
87
|
88
88
LL | let _ = opt.clone().as_mut().map(|x| x.deref_mut()).map(|x| x.len());
89
89
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.clone().as_deref_mut()`
90
90
91
-
error: called `.as_ref().map(Deref::deref)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `opt.as_deref()` instead
91
+
error: called `.as_ref().map(|x| &**x)` on an Option value. This can be done more directly by calling `opt.as_deref()` instead
92
92
--> $DIR/option_as_ref_deref.rs:42:13
93
93
|
94
94
LL | let _ = opt.as_ref().map(|x| &**x);
95
95
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
96
96
97
-
error: called `.as_mut().map(DerefMut::deref_mut)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `opt.as_deref_mut()` instead
97
+
error: called `.as_mut().map(|x| &mut **x)` on an Option value. This can be done more directly by calling `opt.as_deref_mut()` instead
0 commit comments