Skip to content

Commit 08c78e0

Browse files
authored
Replace stray println!() in lint code by bug!() (rust-lang#14618)
To avoid crashing Clippy, the `bug!()` is used only when debug assertions are enabled. In regular usage, the result will be the same as before, but without the extra line printed on the standard output which has the potential for disrupting shell scripts. changelog: none
2 parents 9663da3 + e0c8b4b commit 08c78e0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clippy_lints/src/arbitrary_source_item_ordering.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,9 @@ impl<'tcx> LateLintPass<'tcx> for ArbitrarySourceItemOrdering {
382382
// Filters the auto-included Rust standard library.
383383
continue;
384384
}
385-
println!("Unknown item: {item:?}");
385+
if cfg!(debug_assertions) {
386+
rustc_middle::bug!("unknown item: {item:?}");
387+
}
386388
}
387389
} else if let ItemKind::Impl(_) = item.kind
388390
&& get_item_name(item).is_some()

0 commit comments

Comments
 (0)