@@ -21,9 +21,9 @@ use std::str;
21
21
22
22
use failure:: { Error , ResultExt } ;
23
23
use rustfix:: diagnostics:: Diagnostic ;
24
- use termcolor:: { ColorSpec , WriteColor , Color } ;
24
+ use termcolor:: { Color , ColorSpec , WriteColor } ;
25
25
26
- use diagnostics:: { Message , output_stream } ;
26
+ use diagnostics:: { output_stream , Message } ;
27
27
28
28
mod cli;
29
29
mod diagnostics;
@@ -174,6 +174,10 @@ fn rustfix_crate(rustc: &Path, filename: &str) -> Result<FixedCrate, Error> {
174
174
return Ok ( Default :: default ( ) ) ;
175
175
}
176
176
177
+ let fix_mode = env:: var_os ( "__CARGO_FIX_YOLO" )
178
+ . map ( |_| rustfix:: Filter :: Everything )
179
+ . unwrap_or ( rustfix:: Filter :: MachineApplicableOnly ) ;
180
+
177
181
// Sift through the output of the compiler to look for JSON messages
178
182
// indicating fixes that we can apply.
179
183
let stderr = str:: from_utf8 ( & output. stderr ) . context ( "failed to parse rustc stderr as utf-8" ) ?;
@@ -185,7 +189,7 @@ fn rustfix_crate(rustc: &Path, filename: &str) -> Result<FixedCrate, Error> {
185
189
. filter_map ( |line| serde_json:: from_str :: < Diagnostic > ( line) . ok ( ) )
186
190
187
191
// From each diagnostic try to extract suggestions from rustc
188
- . filter_map ( |diag| rustfix:: collect_suggestions ( & diag, & only) ) ;
192
+ . filter_map ( |diag| rustfix:: collect_suggestions ( & diag, & only, fix_mode ) ) ;
189
193
190
194
// Collect suggestions by file so we can apply them one at a time later.
191
195
let mut file_map = HashMap :: new ( ) ;
0 commit comments