From b26272ba3e9067197e0aff16ba2ce8780e0acb96 Mon Sep 17 00:00:00 2001 From: Akshay Date: Tue, 19 Oct 2021 22:27:23 +0530 Subject: minor refactor --- lib/src/lints/legacy_let_syntax.rs | 7 +++---- lib/src/lints/manual_inherit.rs | 2 +- lib/src/lints/manual_inherit_from.rs | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/src/lints/legacy_let_syntax.rs b/lib/src/lints/legacy_let_syntax.rs index c5588e2..2087e27 100644 --- a/lib/src/lints/legacy_let_syntax.rs +++ b/lib/src/lints/legacy_let_syntax.rs @@ -23,15 +23,14 @@ impl Rule for ManualInherit { if legacy_let .entries() - .find(|kv| matches!(kv.key(), Some(k) if key_is_ident(&k, "body"))) - .is_some(); + .any(|kv| matches!(kv.key(), Some(k) if key_is_ident(&k, "body"))); then { let inherits = legacy_let.inherits(); let entries = legacy_let.entries(); let attrset = make::attrset(inherits, entries, true); - let parenthesized = make::parenthesize(&attrset.node()); - let selected = make::select(parenthesized.node(), &make::ident("body").node()); + let parenthesized = make::parenthesize(attrset.node()); + let selected = make::select(parenthesized.node(), make::ident("body").node()); let at = node.text_range(); let message = "Prefer `rec` over undocumented `let` syntax"; diff --git a/lib/src/lints/manual_inherit.rs b/lib/src/lints/manual_inherit.rs index 3524dd3..69f032b 100644 --- a/lib/src/lints/manual_inherit.rs +++ b/lib/src/lints/manual_inherit.rs @@ -32,7 +32,7 @@ impl Rule for ManualInherit { then { let at = node.text_range(); let replacement = make::inherit_stmt(&[key]).node().clone(); - let message = format!("This assignment is better written with `inherit`"); + let message = "This assignment is better written with `inherit`"; Some(Self::report().suggest(at, message, Suggestion::new(at, replacement))) } else { None diff --git a/lib/src/lints/manual_inherit_from.rs b/lib/src/lints/manual_inherit_from.rs index d7a00b2..2bff5f8 100644 --- a/lib/src/lints/manual_inherit_from.rs +++ b/lib/src/lints/manual_inherit_from.rs @@ -37,7 +37,7 @@ impl Rule for ManualInherit { let set = value.set()?; make::inherit_from_stmt(set, &[key]).node().clone() }; - let message = format!("This assignment is better written with `inherit`"); + let message = "This assignment is better written with `inherit`"; Some(Self::report().suggest(at, message, Suggestion::new(at, replacement))) } else { None -- cgit v1.2.3