From a2a8b42b9a77c635c4b63ae3ffc14478c2c6dc78 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Mon, 18 Jul 2022 14:56:44 -0700 Subject: [PATCH] Remove MatchingLinkResult.warn; unused --- lib/src/markdown_processor.dart | 14 ++++++-------- lib/src/matching_link_result.dart | 16 +++++++--------- test/src/utils.dart | 2 +- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/lib/src/markdown_processor.dart b/lib/src/markdown_processor.dart index caefae85aa..8742066218 100644 --- a/lib/src/markdown_processor.dart +++ b/lib/src/markdown_processor.dart @@ -246,14 +246,12 @@ md.Node _makeLinkNode(String codeRef, Warnable warnable) { // else this would be linkedElement.linkedName, but link bodies are slightly // different for doc references, so fall out. } else { - if (result.warn) { - // Avoid claiming documentation is inherited when it comes from the - // current element. - warnable.warn(PackageWarning.unresolvedDocReference, - message: codeRef, - referredFrom: - warnable.documentationIsLocal ? [] : warnable.documentationFrom); - } + // Avoid claiming documentation is inherited when it comes from the + // current element. + warnable.warn(PackageWarning.unresolvedDocReference, + message: codeRef, + referredFrom: + warnable.documentationIsLocal ? [] : warnable.documentationFrom); } return md.Element.text('code', textContent); diff --git a/lib/src/matching_link_result.dart b/lib/src/matching_link_result.dart index 6eb47e2c87..98a3de446d 100644 --- a/lib/src/matching_link_result.dart +++ b/lib/src/matching_link_result.dart @@ -7,22 +7,20 @@ import 'package:dartdoc/src/model/model.dart'; class MatchingLinkResult { final CommentReferable? commentReferable; - final bool warn; - MatchingLinkResult(this.commentReferable, {this.warn = true}); + MatchingLinkResult(this.commentReferable); @override - bool operator ==(Object other) { - return other is MatchingLinkResult && - commentReferable == other.commentReferable && - warn == other.warn; - } + bool operator ==(Object other) => + other is MatchingLinkResult && commentReferable == other.commentReferable; @override - int get hashCode => Object.hash(commentReferable, warn); + int get hashCode => commentReferable.hashCode; @override String toString() { - return 'element: [${commentReferable is Constructor ? 'new ' : ''}${commentReferable?.fullyQualifiedName}] warn: $warn'; + // TODO(srawlins): Scrap the 'new' keyword? + final newKeyword = commentReferable is Constructor ? 'new ' : ''; + return 'element: [$newKeyword${commentReferable?.fullyQualifiedName}]'; } } diff --git a/test/src/utils.dart b/test/src/utils.dart index 55a174888b..c3b9443c5a 100644 --- a/test/src/utils.dart +++ b/test/src/utils.dart @@ -309,7 +309,7 @@ MatchingLinkResult definingLinkResult(MatchingLinkResult originalResult) { if (definingReferable != null && definingReferable != originalResult.commentReferable) { - return MatchingLinkResult(definingReferable, warn: originalResult.warn); + return MatchingLinkResult(definingReferable); } return originalResult; }