From ea0dbd5ce06ad285a77c51e79131e3f185c9af8a Mon Sep 17 00:00:00 2001 From: Till Friebe Date: Sat, 22 May 2021 10:44:41 +0200 Subject: [PATCH] Don't create a lambda when a tear-off will do --- analysis_options.yaml | 1 + lib/src/models/rules/insert.dart | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 06d7ee1c..7749c861 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -32,5 +32,6 @@ linter: - prefer_single_quotes - sort_constructors_first - sort_unnamed_constructors_first + - unnecessary_lambdas - unnecessary_parenthesis - unnecessary_string_interpolations diff --git a/lib/src/models/rules/insert.dart b/lib/src/models/rules/insert.dart index 9c10d422..f50be23f 100644 --- a/lib/src/models/rules/insert.dart +++ b/lib/src/models/rules/insert.dart @@ -189,7 +189,7 @@ class AutoExitBlockRule extends InsertRule { // therefore we can exit this block. final attributes = cur.attributes ?? {}; final k = attributes.keys - .firstWhere((k) => Attribute.blockKeysExceptHeader.contains(k)); + .firstWhere(Attribute.blockKeysExceptHeader.contains); attributes[k] = null; // retain(1) should be '\n', set it with no attribute return Delta()..retain(index + (len ?? 0))..retain(1, attributes);