diff options
| author | Yuri Astrakhan <YuriAstrakhan@gmail.com> | 2024-09-28 13:17:29 -0400 |
|---|---|---|
| committer | Yuri Astrakhan <YuriAstrakhan@gmail.com> | 2024-09-28 13:17:29 -0400 |
| commit | 10e02cf8e3e8b46d3bc7f8194c9224755604eac4 (patch) | |
| tree | 27ce7c61fc6a2866be9909c2249263aedc84a423 | |
| parent | 38295a0d8acf04a55567cbc1bfa3eddd45e5e702 (diff) | |
| download | rust-10e02cf8e3e8b46d3bc7f8194c9224755604eac4.tar.gz rust-10e02cf8e3e8b46d3bc7f8194c9224755604eac4.zip | |
suggest &str
| -rw-r--r-- | clippy_lints/src/functions/mod.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clippy_lints/src/functions/mod.rs b/clippy_lints/src/functions/mod.rs index 50b3d039ed3..203c3ce9eec 100644 --- a/clippy_lints/src/functions/mod.rs +++ b/clippy_lints/src/functions/mod.rs @@ -432,8 +432,10 @@ declare_clippy_lint! { /// ``` /// Use instead: /// ```no_run - /// // caller should use foo(opt.as_ref()) - /// fn foo(a: Option<&String>) {} + /// // caller should use `foo1(opt.as_ref())` + /// fn foo1(a: Option<&String>) {} + /// // better yet, use string slice `foo2(opt.as_deref())` + /// fn foo2(a: Option<&str>) {} /// # struct Unit {} /// # impl Unit { /// fn bar(&self) -> Option<&String> { None } |
