Skip to content

Commit 3037c40

Browse files
committed
Avoid more invocations of hir_crate query.
1 parent 23d5457 commit 3037c40

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

clippy_lints/src/missing_doc.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ impl MissingDoc {
7878
return;
7979
}
8080

81-
let has_doc = attrs
82-
.iter()
83-
.any(|a| a.doc_str().is_some());
81+
let has_doc = attrs.iter().any(|a| a.doc_str().is_some());
8482
if !has_doc {
8583
span_lint(
8684
cx,
@@ -104,9 +102,9 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
104102
self.doc_hidden_stack.pop().expect("empty doc_hidden_stack");
105103
}
106104

107-
fn check_crate(&mut self, cx: &LateContext<'tcx>, krate: &'tcx hir::Crate<'_>) {
105+
fn check_crate(&mut self, cx: &LateContext<'tcx>, _: &'tcx hir::Crate<'_>) {
108106
let attrs = cx.tcx.hir().attrs(hir::CRATE_HIR_ID);
109-
self.check_missing_docs_attrs(cx, attrs, krate.module().inner, "the", "crate");
107+
self.check_missing_docs_attrs(cx, attrs, cx.tcx.hir().root_module().inner, "the", "crate");
110108
}
111109

112110
fn check_item(&mut self, cx: &LateContext<'tcx>, it: &'tcx hir::Item<'_>) {

0 commit comments

Comments
 (0)