diff options
| author | flip1995 <philipp.krones@embecosm.com> | 2021-12-06 12:33:31 +0100 |
|---|---|---|
| committer | flip1995 <philipp.krones@embecosm.com> | 2021-12-06 12:33:31 +0100 |
| commit | 8fea1d94f3bbcc02c3822dd43da9a1133e90f715 (patch) | |
| tree | c571ad0e3fb19726b5e0fbe9df641885ddf0524d /clippy_lints/src/repeat_once.rs | |
| parent | 35a0060aba4bc9ff4e2b8faa20b91762c3109b18 (diff) | |
Merge commit 'a5d597637dcb78dc73f93561ce474f23d4177c35' into clippyup
Diffstat (limited to 'clippy_lints/src/repeat_once.rs')
| -rw-r--r-- | clippy_lints/src/repeat_once.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clippy_lints/src/repeat_once.rs b/clippy_lints/src/repeat_once.rs index cf94c0e97d9..b5dd2de6337 100644 --- a/clippy_lints/src/repeat_once.rs +++ b/clippy_lints/src/repeat_once.rs @@ -1,6 +1,5 @@ use clippy_utils::consts::{constant_context, Constant}; use clippy_utils::diagnostics::span_lint_and_sugg; -use clippy_utils::in_macro; use clippy_utils::source::snippet; use clippy_utils::ty::is_type_diagnostic_item; use if_chain::if_chain; @@ -36,6 +35,7 @@ declare_clippy_lint! { /// let x = String::from("hello world").clone(); /// } /// ``` + #[clippy::version = "1.47.0"] pub REPEAT_ONCE, complexity, "using `.repeat(1)` instead of `String.clone()`, `str.to_string()` or `slice.to_vec()` " @@ -49,7 +49,7 @@ impl<'tcx> LateLintPass<'tcx> for RepeatOnce { if let ExprKind::MethodCall(path, _, [receiver, count], _) = &expr.kind; if path.ident.name == sym!(repeat); if constant_context(cx, cx.typeck_results()).expr(count) == Some(Constant::Int(1)); - if !in_macro(receiver.span); + if !receiver.span.from_expansion(); then { let ty = cx.typeck_results().expr_ty(receiver).peel_refs(); if ty.is_str() { |
