summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/option_as_ref_deref.stderr
blob: 7de8b3b6ba4355c55d3fb0a7712f7e43253e1596 (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
error: called `.as_ref().map(Deref::deref)` on an Option value. This can be done more directly by calling `opt.clone().as_deref()` instead
  --> $DIR/option_as_ref_deref.rs:14:13
   |
LL |     let _ = opt.clone().as_ref().map(Deref::deref).map(str::len);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.clone().as_deref()`
   |
   = note: `-D clippy::option-as-ref-deref` implied by `-D warnings`

error: called `.as_ref().map(Deref::deref)` on an Option value. This can be done more directly by calling `opt.clone().as_deref()` instead
  --> $DIR/option_as_ref_deref.rs:17:13
   |
LL |       let _ = opt.clone()
   |  _____________^
LL | |         .as_ref().map(
LL | |             Deref::deref
LL | |         )
   | |_________^ help: try using as_deref instead: `opt.clone().as_deref()`

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
  --> $DIR/option_as_ref_deref.rs:23:13
   |
LL |     let _ = opt.as_mut().map(DerefMut::deref_mut);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`

error: called `.as_ref().map(String::as_str)` on an Option value. This can be done more directly by calling `opt.as_deref()` instead
  --> $DIR/option_as_ref_deref.rs:25:13
   |
LL |     let _ = opt.as_ref().map(String::as_str);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`

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
  --> $DIR/option_as_ref_deref.rs:26:13
   |
LL |     let _ = opt.as_ref().map(|x| x.as_str());
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`

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
  --> $DIR/option_as_ref_deref.rs:27:13
   |
LL |     let _ = opt.as_mut().map(String::as_mut_str);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`

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
  --> $DIR/option_as_ref_deref.rs:28:13
   |
LL |     let _ = opt.as_mut().map(|x| x.as_mut_str());
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`

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
  --> $DIR/option_as_ref_deref.rs:29:13
   |
LL |     let _ = Some(CString::new(vec![]).unwrap()).as_ref().map(CString::as_c_str);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(CString::new(vec![]).unwrap()).as_deref()`

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
  --> $DIR/option_as_ref_deref.rs:30:13
   |
LL |     let _ = Some(OsString::new()).as_ref().map(OsString::as_os_str);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(OsString::new()).as_deref()`

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
  --> $DIR/option_as_ref_deref.rs:31:13
   |
LL |     let _ = Some(PathBuf::new()).as_ref().map(PathBuf::as_path);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(PathBuf::new()).as_deref()`

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
  --> $DIR/option_as_ref_deref.rs:32:13
   |
LL |     let _ = Some(Vec::<()>::new()).as_ref().map(Vec::as_slice);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(Vec::<()>::new()).as_deref()`

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
  --> $DIR/option_as_ref_deref.rs:33:13
   |
LL |     let _ = Some(Vec::<()>::new()).as_mut().map(Vec::as_mut_slice);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `Some(Vec::<()>::new()).as_deref_mut()`

error: called `.as_ref().map(|x| x.deref())` on an Option value. This can be done more directly by calling `opt.as_deref()` instead
  --> $DIR/option_as_ref_deref.rs:35:13
   |
LL |     let _ = opt.as_ref().map(|x| x.deref());
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`

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
  --> $DIR/option_as_ref_deref.rs:36:13
   |
LL |     let _ = opt.clone().as_mut().map(|x| x.deref_mut()).map(|x| x.len());
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.clone().as_deref_mut()`

error: called `.as_ref().map(|x| &**x)` on an Option value. This can be done more directly by calling `opt.as_deref()` instead
  --> $DIR/option_as_ref_deref.rs:43:13
   |
LL |     let _ = opt.as_ref().map(|x| &**x);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`

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
  --> $DIR/option_as_ref_deref.rs:44:13
   |
LL |     let _ = opt.as_mut().map(|x| &mut **x);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`

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
  --> $DIR/option_as_ref_deref.rs:47:13
   |
LL |     let _ = opt.as_ref().map(std::ops::Deref::deref);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`

error: called `.as_ref().map(String::as_str)` on an Option value. This can be done more directly by calling `opt.as_deref()` instead
  --> $DIR/option_as_ref_deref.rs:61:13
   |
LL |     let _ = opt.as_ref().map(String::as_str);
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`

error: aborting due to 18 previous errors