]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/option_as_ref_deref.stderr
Auto merge of #97191 - wesleywiser:main_thread_name, r=ChrisDenton
[rust.git] / src / tools / clippy / tests / ui / option_as_ref_deref.stderr
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   --> $DIR/option_as_ref_deref.rs:13:13
3    |
4 LL |     let _ = opt.clone().as_ref().map(Deref::deref).map(str::len);
5    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.clone().as_deref()`
6    |
7    = note: `-D clippy::option-as-ref-deref` implied by `-D warnings`
8
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   --> $DIR/option_as_ref_deref.rs:16:13
11    |
12 LL |       let _ = opt.clone()
13    |  _____________^
14 LL | |         .as_ref().map(
15 LL | |             Deref::deref
16 LL | |         )
17    | |_________^ help: try using as_deref instead: `opt.clone().as_deref()`
18
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   --> $DIR/option_as_ref_deref.rs:22:13
21    |
22 LL |     let _ = opt.as_mut().map(DerefMut::deref_mut);
23    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
24
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   --> $DIR/option_as_ref_deref.rs:24:13
27    |
28 LL |     let _ = opt.as_ref().map(String::as_str);
29    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
30
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   --> $DIR/option_as_ref_deref.rs:25:13
33    |
34 LL |     let _ = opt.as_ref().map(|x| x.as_str());
35    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
36
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   --> $DIR/option_as_ref_deref.rs:26:13
39    |
40 LL |     let _ = opt.as_mut().map(String::as_mut_str);
41    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
42
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   --> $DIR/option_as_ref_deref.rs:27:13
45    |
46 LL |     let _ = opt.as_mut().map(|x| x.as_mut_str());
47    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
48
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   --> $DIR/option_as_ref_deref.rs:28:13
51    |
52 LL |     let _ = Some(CString::new(vec![]).unwrap()).as_ref().map(CString::as_c_str);
53    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(CString::new(vec![]).unwrap()).as_deref()`
54
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   --> $DIR/option_as_ref_deref.rs:29:13
57    |
58 LL |     let _ = Some(OsString::new()).as_ref().map(OsString::as_os_str);
59    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(OsString::new()).as_deref()`
60
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   --> $DIR/option_as_ref_deref.rs:30:13
63    |
64 LL |     let _ = Some(PathBuf::new()).as_ref().map(PathBuf::as_path);
65    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(PathBuf::new()).as_deref()`
66
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   --> $DIR/option_as_ref_deref.rs:31:13
69    |
70 LL |     let _ = Some(Vec::<()>::new()).as_ref().map(Vec::as_slice);
71    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(Vec::<()>::new()).as_deref()`
72
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   --> $DIR/option_as_ref_deref.rs:32:13
75    |
76 LL |     let _ = Some(Vec::<()>::new()).as_mut().map(Vec::as_mut_slice);
77    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `Some(Vec::<()>::new()).as_deref_mut()`
78
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   --> $DIR/option_as_ref_deref.rs:34:13
81    |
82 LL |     let _ = opt.as_ref().map(|x| x.deref());
83    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
84
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   --> $DIR/option_as_ref_deref.rs:35:13
87    |
88 LL |     let _ = opt.clone().as_mut().map(|x| x.deref_mut()).map(|x| x.len());
89    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.clone().as_deref_mut()`
90
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   --> $DIR/option_as_ref_deref.rs:42:13
93    |
94 LL |     let _ = opt.as_ref().map(|x| &**x);
95    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
96
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
98   --> $DIR/option_as_ref_deref.rs:43:13
99    |
100 LL |     let _ = opt.as_mut().map(|x| &mut **x);
101    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
102
103 error: called `.as_ref().map(std::ops::Deref::deref)` on an Option value. This can be done more directly by calling `opt.as_deref()` instead
104   --> $DIR/option_as_ref_deref.rs:46:13
105    |
106 LL |     let _ = opt.as_ref().map(std::ops::Deref::deref);
107    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
108
109 error: aborting due to 17 previous errors
110