Lints and suggestions for the Nix programming language
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor(bool_comparison): improve locality of a binding

Co-authored-by: x10an14 <x10an14@users.noreply.github.com>

+1 -1
+1 -1
lib/src/lints/bool_comparison.rs
··· 54 54 return None; 55 55 }; 56 56 57 - let at = node.text_range(); 58 57 let replacement = match (boolean_ident(&bool_side).unwrap(), op == BinOpKind::Equal) { 59 58 (NixBoolean::True, true) | (NixBoolean::False, false) => { 60 59 // `a == true`, `a != false` replace with just `a` ··· 85 84 } 86 85 }; 87 86 let message = format!("Comparing `{non_bool_side}` with boolean literal `{bool_side}`"); 87 + let at = node.text_range(); 88 88 Some( 89 89 self.report() 90 90 .suggest(at, message, Suggestion::new(at, replacement)),