]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/option_as_ref_deref.stderr
New upstream version 1.52.1+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / option_as_ref_deref.stderr
CommitLineData
f20569fa
XL
1error: 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 |
4LL | 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
9error: 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 |
12LL | let _ = opt.clone()
13 | _____________^
14LL | | .as_ref().map(
15LL | | Deref::deref
16LL | | )
17 | |_________^ help: try using as_deref instead: `opt.clone().as_deref()`
18
19error: 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 |
22LL | let _ = opt.as_mut().map(DerefMut::deref_mut);
23 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
24
25error: 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 |
28LL | let _ = opt.as_ref().map(String::as_str);
29 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
30
31error: 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 |
34LL | let _ = opt.as_ref().map(|x| x.as_str());
35 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
36
37error: 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 |
40LL | let _ = opt.as_mut().map(String::as_mut_str);
41 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
42
43error: 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 |
46LL | let _ = opt.as_mut().map(|x| x.as_mut_str());
47 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
48
49error: 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 |
52LL | 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
55error: 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 |
58LL | let _ = Some(OsString::new()).as_ref().map(OsString::as_os_str);
59 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(OsString::new()).as_deref()`
60
61error: 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 |
64LL | let _ = Some(PathBuf::new()).as_ref().map(PathBuf::as_path);
65 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(PathBuf::new()).as_deref()`
66
67error: 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 |
70LL | let _ = Some(Vec::<()>::new()).as_ref().map(Vec::as_slice);
71 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(Vec::<()>::new()).as_deref()`
72
73error: 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 |
76LL | 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
79error: 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 |
82LL | let _ = opt.as_ref().map(|x| x.deref());
83 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
84
85error: 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 |
88LL | 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
91error: 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 |
94LL | let _ = opt.as_ref().map(|x| &**x);
95 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
96
97error: 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 |
100LL | let _ = opt.as_mut().map(|x| &mut **x);
101 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
102
103error: 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 |
106LL | let _ = opt.as_ref().map(std::ops::Deref::deref);
107 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
108
109error: aborting due to 17 previous errors
110