Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

Commit 23d56b9

Browse files
committed
remove unnecessary boolean literals
1 parent 6247ab5 commit 23d56b9

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

lib/src/ast.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ class _ElementVisitorAdapter extends GeneralizingElementVisitor {
422422
@override
423423
void visitElement(Element element) {
424424
var visitChildren = processor(element);
425-
if (visitChildren == true) {
425+
if (visitChildren) {
426426
element.visitChildren(this);
427427
}
428428
}

lib/src/rules/avoid_positional_boolean_parameters.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class _Visitor extends SimpleAstVisitor<void> {
6868
if (declaredElement != null && !declaredElement.isPrivate) {
6969
var parametersToLint =
7070
node.parameters.parameters.where(_isFormalParameterToLint);
71-
if (parametersToLint.isNotEmpty == true) {
71+
if (parametersToLint.isNotEmpty) {
7272
rule.reportLint(parametersToLint.first);
7373
}
7474
}

lib/src/rules/valid_regexps.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class _Visitor extends SimpleAstVisitor<void> {
5959
return;
6060
}
6161

62-
bool isTrue(Expression e) => e is BooleanLiteral && e.value == true;
62+
bool isTrue(Expression e) => e is BooleanLiteral && e.value;
6363

6464
var unicode = args.any((arg) =>
6565
arg is NamedExpression &&

lib/src/test_utilities/annotation.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ class Annotation implements Comparable<Annotation> {
6262
extension on String? {
6363
int? toInt() => this == null ? null : int.parse(this!);
6464
String? toNullIfBlank() =>
65-
this == null || this!.trim().isEmpty == true ? null : this;
65+
this == null || this!.trim().isEmpty ? null : this;
6666
}

0 commit comments

Comments
 (0)