From 9ff1340a698d315040af85523776303d199f42f8 Mon Sep 17 00:00:00 2001 From: Philipp Hansch <dev@phansch.net> Date: Thu, 28 Feb 2019 07:00:22 +0100 Subject: [PATCH] Use positive if condition for readability --- doc/adding_lints.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/adding_lints.md b/doc/adding_lints.md index c61e247f9cf..852277d8eb2 100644 --- a/doc/adding_lints.md +++ b/doc/adding_lints.md @@ -228,14 +228,15 @@ With that we can expand our `check_fn` method to: ```rust impl EarlyLintPass for Pass { fn check_fn(&mut self, cx: &EarlyContext<'_>, fn_kind: FnKind<'_>, _: &FnDecl, span: Span, _: NodeId) { - if !is_foo_fn(fn_kind) { return; } - span_help_and_lint( - cx, - FOO_FUNCTIONS, - span, - "function named `foo`", - "consider using a more meaningful name" - ); + if is_foo_fn(fn_kind) { + span_help_and_lint( + cx, + FOO_FUNCTIONS, + span, + "function named `foo`", + "consider using a more meaningful name" + ); + } } } ```