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(empty_pattern): use let-else in is_module

+8 -10
+8 -10
lib/src/lints/empty_pattern.rs
··· 71 71 } 72 72 73 73 fn is_module(body: &SyntaxNode) -> bool { 74 - if let Some(attr_set) = AttrSet::cast(body.clone()) 75 - && attr_set 76 - .entries() 77 - .filter_map(|e| e.key()) 78 - .any(|k| k.node().to_string() == "imports") 79 - { 80 - true 81 - } else { 82 - false 83 - } 74 + let Some(attr_set) = AttrSet::cast(body.clone()) else { 75 + return false; 76 + }; 77 + 78 + attr_set 79 + .entries() 80 + .filter_map(|e| e.key()) 81 + .any(|k| k.node().to_string() == "imports") 84 82 }