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 {
225
225
let warnings: Vec < ClippyWarning > = output_lines
226
226
. into_iter ( )
227
227
// get all clippy warnings and ICEs
228
- . filter ( |line| line . contains ( "clippy::" ) || line. contains ( "internal compiler error: " ) )
228
+ . filter ( |line| filter_clippy_warnings ( & line) )
229
229
. map ( |json_msg| parse_json_message ( json_msg, & self ) )
230
230
. collect ( ) ;
231
231
warnings
232
232
}
233
233
}
234
234
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
+
235
258
/// Builds clippy inside the repo to make sure we have a clippy executable we can use.
236
259
fn build_clippy ( ) {
237
260
Command :: new ( "cargo" )
You can’t perform that action at this time.
0 commit comments