Skip to content

Commit e6c8861

Browse files
authored
Remove MatchingLinkResult.warn; unused (#3090)
1 parent 7b7322f commit e6c8861

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

lib/src/markdown_processor.dart

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,12 @@ md.Node _makeLinkNode(String codeRef, Warnable warnable) {
246246
// else this would be linkedElement.linkedName, but link bodies are slightly
247247
// different for doc references, so fall out.
248248
} else {
249-
if (result.warn) {
250-
// Avoid claiming documentation is inherited when it comes from the
251-
// current element.
252-
warnable.warn(PackageWarning.unresolvedDocReference,
253-
message: codeRef,
254-
referredFrom:
255-
warnable.documentationIsLocal ? [] : warnable.documentationFrom);
256-
}
249+
// Avoid claiming documentation is inherited when it comes from the
250+
// current element.
251+
warnable.warn(PackageWarning.unresolvedDocReference,
252+
message: codeRef,
253+
referredFrom:
254+
warnable.documentationIsLocal ? [] : warnable.documentationFrom);
257255
}
258256

259257
return md.Element.text('code', textContent);

lib/src/matching_link_result.dart

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,20 @@ import 'package:dartdoc/src/model/model.dart';
77

88
class MatchingLinkResult {
99
final CommentReferable? commentReferable;
10-
final bool warn;
1110

12-
MatchingLinkResult(this.commentReferable, {this.warn = true});
11+
MatchingLinkResult(this.commentReferable);
1312

1413
@override
15-
bool operator ==(Object other) {
16-
return other is MatchingLinkResult &&
17-
commentReferable == other.commentReferable &&
18-
warn == other.warn;
19-
}
14+
bool operator ==(Object other) =>
15+
other is MatchingLinkResult && commentReferable == other.commentReferable;
2016

2117
@override
22-
int get hashCode => Object.hash(commentReferable, warn);
18+
int get hashCode => commentReferable.hashCode;
2319

2420
@override
2521
String toString() {
26-
return 'element: [${commentReferable is Constructor ? 'new ' : ''}${commentReferable?.fullyQualifiedName}] warn: $warn';
22+
// TODO(srawlins): Scrap the 'new' keyword?
23+
final newKeyword = commentReferable is Constructor ? 'new ' : '';
24+
return 'element: [$newKeyword${commentReferable?.fullyQualifiedName}]';
2725
}
2826
}

test/src/utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ MatchingLinkResult definingLinkResult(MatchingLinkResult originalResult) {
309309

310310
if (definingReferable != null &&
311311
definingReferable != originalResult.commentReferable) {
312-
return MatchingLinkResult(definingReferable, warn: originalResult.warn);
312+
return MatchingLinkResult(definingReferable);
313313
}
314314
return originalResult;
315315
}

0 commit comments

Comments
 (0)