Skip to content

Commit 2537232

Browse files
committed
Use positive if condition for readability
1 parent befa9b5 commit 2537232

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

doc/adding_lints.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,15 @@ With that we can expand our `check_fn` method to:
228228
```rust
229229
impl EarlyLintPass for Pass {
230230
fn check_fn(&mut self, cx: &EarlyContext<'_>, fn_kind: FnKind<'_>, _: &FnDecl, span: Span, _: NodeId) {
231-
if !is_foo_fn(fn_kind) { return; }
232-
span_help_and_lint(
233-
cx,
234-
FOO_FUNCTIONS,
235-
span,
236-
"function named `foo`",
237-
"consider using a more meaningful name"
238-
);
231+
if is_foo_fn(fn_kind) {
232+
span_help_and_lint(
233+
cx,
234+
FOO_FUNCTIONS,
235+
span,
236+
"function named `foo`",
237+
"consider using a more meaningful name"
238+
);
239+
}
239240
}
240241
}
241242
```

0 commit comments

Comments
 (0)