2023-12-01 11:21:58 -06:00
|
|
|
error: called `.as_ref().map(Deref::deref)` on an `Option` value
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/option_as_ref_deref.rs:11:13
|
2019-12-22 22:48:15 -06:00
|
|
|
|
|
|
|
|
LL | let _ = opt.clone().as_ref().map(Deref::deref).map(str::len);
|
2024-01-25 12:17:36 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `opt.clone().as_deref()`
|
2019-12-22 22:48:15 -06:00
|
|
|
|
|
|
|
|
= note: `-D clippy::option-as-ref-deref` implied by `-D warnings`
|
2023-08-01 07:02:21 -05:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::option_as_ref_deref)]`
|
2019-12-22 22:48:15 -06:00
|
|
|
|
2023-12-01 11:21:58 -06:00
|
|
|
error: called `.as_ref().map(Deref::deref)` on an `Option` value
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/option_as_ref_deref.rs:14:13
|
2019-12-22 22:48:15 -06:00
|
|
|
|
|
|
|
|
LL | let _ = opt.clone()
|
|
|
|
| _____________^
|
|
|
|
LL | | .as_ref().map(
|
|
|
|
LL | | Deref::deref
|
|
|
|
LL | | )
|
2024-01-25 12:17:36 -06:00
|
|
|
| |_________^ help: consider using as_deref: `opt.clone().as_deref()`
|
2019-12-22 22:48:15 -06:00
|
|
|
|
2023-12-01 11:21:58 -06:00
|
|
|
error: called `.as_mut().map(DerefMut::deref_mut)` on an `Option` value
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/option_as_ref_deref.rs:20:13
|
2019-12-22 22:48:15 -06:00
|
|
|
|
|
|
|
|
LL | let _ = opt.as_mut().map(DerefMut::deref_mut);
|
2024-01-25 12:17:36 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref_mut: `opt.as_deref_mut()`
|
2019-12-22 22:48:15 -06:00
|
|
|
|
2023-12-01 11:21:58 -06:00
|
|
|
error: called `.as_ref().map(String::as_str)` on an `Option` value
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/option_as_ref_deref.rs:22:13
|
2019-12-22 22:48:15 -06:00
|
|
|
|
|
|
|
|
LL | let _ = opt.as_ref().map(String::as_str);
|
2024-01-25 12:17:36 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `opt.as_deref()`
|
2019-12-22 22:48:15 -06:00
|
|
|
|
2023-12-01 11:21:58 -06:00
|
|
|
error: called `.as_ref().map(|x| x.as_str())` on an `Option` value
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/option_as_ref_deref.rs:23:13
|
2019-12-22 22:48:15 -06:00
|
|
|
|
|
|
|
|
LL | let _ = opt.as_ref().map(|x| x.as_str());
|
2024-01-25 12:17:36 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `opt.as_deref()`
|
2019-12-22 22:48:15 -06:00
|
|
|
|
2023-12-01 11:21:58 -06:00
|
|
|
error: called `.as_mut().map(String::as_mut_str)` on an `Option` value
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/option_as_ref_deref.rs:24:13
|
2019-12-22 22:48:15 -06:00
|
|
|
|
|
|
|
|
LL | let _ = opt.as_mut().map(String::as_mut_str);
|
2024-01-25 12:17:36 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref_mut: `opt.as_deref_mut()`
|
2019-12-22 22:48:15 -06:00
|
|
|
|
2023-12-01 11:21:58 -06:00
|
|
|
error: called `.as_mut().map(|x| x.as_mut_str())` on an `Option` value
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/option_as_ref_deref.rs:25:13
|
2019-12-22 22:48:15 -06:00
|
|
|
|
|
|
|
|
LL | let _ = opt.as_mut().map(|x| x.as_mut_str());
|
2024-01-25 12:17:36 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref_mut: `opt.as_deref_mut()`
|
2019-12-22 22:48:15 -06:00
|
|
|
|
2023-12-01 11:21:58 -06:00
|
|
|
error: called `.as_ref().map(CString::as_c_str)` on an `Option` value
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/option_as_ref_deref.rs:26:13
|
2019-12-22 22:48:15 -06:00
|
|
|
|
|
|
|
|
LL | let _ = Some(CString::new(vec![]).unwrap()).as_ref().map(CString::as_c_str);
|
2024-01-25 12:17:36 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `Some(CString::new(vec![]).unwrap()).as_deref()`
|
2019-12-22 22:48:15 -06:00
|
|
|
|
2023-12-01 11:21:58 -06:00
|
|
|
error: called `.as_ref().map(OsString::as_os_str)` on an `Option` value
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/option_as_ref_deref.rs:27:13
|
2019-12-22 22:48:15 -06:00
|
|
|
|
|
|
|
|
LL | let _ = Some(OsString::new()).as_ref().map(OsString::as_os_str);
|
2024-01-25 12:17:36 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `Some(OsString::new()).as_deref()`
|
2019-12-22 22:48:15 -06:00
|
|
|
|
2023-12-01 11:21:58 -06:00
|
|
|
error: called `.as_ref().map(PathBuf::as_path)` on an `Option` value
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/option_as_ref_deref.rs:28:13
|
2019-12-22 22:48:15 -06:00
|
|
|
|
|
|
|
|
LL | let _ = Some(PathBuf::new()).as_ref().map(PathBuf::as_path);
|
2024-01-25 12:17:36 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `Some(PathBuf::new()).as_deref()`
|
2019-12-22 22:48:15 -06:00
|
|
|
|
2023-12-01 11:21:58 -06:00
|
|
|
error: called `.as_ref().map(Vec::as_slice)` on an `Option` value
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/option_as_ref_deref.rs:29:13
|
2019-12-22 22:48:15 -06:00
|
|
|
|
|
|
|
|
LL | let _ = Some(Vec::<()>::new()).as_ref().map(Vec::as_slice);
|
2024-01-25 12:17:36 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `Some(Vec::<()>::new()).as_deref()`
|
2019-12-22 22:48:15 -06:00
|
|
|
|
2023-12-01 11:21:58 -06:00
|
|
|
error: called `.as_mut().map(Vec::as_mut_slice)` on an `Option` value
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/option_as_ref_deref.rs:30:13
|
2019-12-22 22:48:15 -06:00
|
|
|
|
|
|
|
|
LL | let _ = Some(Vec::<()>::new()).as_mut().map(Vec::as_mut_slice);
|
2024-01-25 12:17:36 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref_mut: `Some(Vec::<()>::new()).as_deref_mut()`
|
2019-12-22 22:48:15 -06:00
|
|
|
|
2023-12-01 11:21:58 -06:00
|
|
|
error: called `.as_ref().map(|x| x.deref())` on an `Option` value
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/option_as_ref_deref.rs:32:13
|
2019-12-22 22:48:15 -06:00
|
|
|
|
|
|
|
|
LL | let _ = opt.as_ref().map(|x| x.deref());
|
2024-01-25 12:17:36 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `opt.as_deref()`
|
2019-12-22 22:48:15 -06:00
|
|
|
|
2023-12-01 11:21:58 -06:00
|
|
|
error: called `.as_mut().map(|x| x.deref_mut())` on an `Option` value
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/option_as_ref_deref.rs:33:13
|
2019-12-22 22:48:15 -06:00
|
|
|
|
|
|
|
|
LL | let _ = opt.clone().as_mut().map(|x| x.deref_mut()).map(|x| x.len());
|
2024-01-25 12:17:36 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref_mut: `opt.clone().as_deref_mut()`
|
2019-12-22 22:48:15 -06:00
|
|
|
|
2023-12-01 11:21:58 -06:00
|
|
|
error: called `.as_ref().map(|x| &**x)` on an `Option` value
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/option_as_ref_deref.rs:40:13
|
2020-04-06 08:48:38 -05:00
|
|
|
|
|
|
|
|
LL | let _ = opt.as_ref().map(|x| &**x);
|
2024-01-25 12:17:36 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `opt.as_deref()`
|
2020-04-06 08:48:38 -05:00
|
|
|
|
2023-12-01 11:21:58 -06:00
|
|
|
error: called `.as_mut().map(|x| &mut **x)` on an `Option` value
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/option_as_ref_deref.rs:41:13
|
2020-04-06 08:48:38 -05:00
|
|
|
|
|
|
|
|
LL | let _ = opt.as_mut().map(|x| &mut **x);
|
2024-01-25 12:17:36 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref_mut: `opt.as_deref_mut()`
|
2020-04-06 08:48:38 -05:00
|
|
|
|
2023-12-01 11:21:58 -06:00
|
|
|
error: called `.as_ref().map(std::ops::Deref::deref)` on an `Option` value
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/option_as_ref_deref.rs:44:13
|
2020-08-28 09:10:16 -05:00
|
|
|
|
|
|
|
|
LL | let _ = opt.as_ref().map(std::ops::Deref::deref);
|
2024-01-25 12:17:36 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `opt.as_deref()`
|
2020-08-28 09:10:16 -05:00
|
|
|
|
2023-12-01 11:21:58 -06:00
|
|
|
error: called `.as_ref().map(String::as_str)` on an `Option` value
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/option_as_ref_deref.rs:56:13
|
2022-10-23 08:18:45 -05:00
|
|
|
|
|
|
|
|
LL | let _ = opt.as_ref().map(String::as_str);
|
2024-01-25 12:17:36 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using as_deref: `opt.as_deref()`
|
2022-10-23 08:18:45 -05:00
|
|
|
|
|
|
|
error: aborting due to 18 previous errors
|
2019-12-22 22:48:15 -06:00
|
|
|
|