File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -225,13 +225,36 @@ impl Crate {
225225 let warnings: Vec < ClippyWarning > = output_lines
226226 . into_iter ( )
227227 // get all clippy warnings and ICEs
228- . filter ( |line| line . contains ( "clippy::" ) || line. contains ( "internal compiler error: " ) )
228+ . filter ( |line| filter_clippy_warnings ( & line) )
229229 . map ( |json_msg| parse_json_message ( json_msg, & self ) )
230230 . collect ( ) ;
231231 warnings
232232 }
233233}
234234
235+ /// takes a single json-formatted clippy warnings and returns true (we are interested in that line)
236+ /// or false (we aren't)
237+ fn filter_clippy_warnings ( line : & str ) -> bool {
238+ // we want to collect ICEs because clippy might have crashed.
239+ // these are summarized later
240+ if line. contains ( "internal compiler error: " ) {
241+ return true ;
242+ }
243+ // in general, we want all clippy warnings
244+ // however due to some kind of bug, sometimes there are absolute paths
245+ // to libcore files inside the message
246+ // or we end up with cargo-metadata output (https://github.com/rust-lang/rust-clippy/issues/6508)
247+
248+ // filter out these message to avoid unnecessary noise in the logs
249+ if line. contains ( "clippy::" )
250+ && !( line. contains ( "could not read cargo metadata" )
251+ || ( line. contains ( ".rustup" ) && line. contains ( "toolchains" ) ) )
252+ {
253+ return true ;
254+ }
255+ false
256+ }
257+
235258/// Builds clippy inside the repo to make sure we have a clippy executable we can use.
236259fn build_clippy ( ) {
237260 Command :: new ( "cargo" )
You can’t perform that action at this time.
0 commit comments