Skip to content

Commit e0c8b4b

Browse files
committed
Replace stray println!() in lint code by bug!()
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.
1 parent d3267e9 commit e0c8b4b

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)