-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: make arg passing for fix match other subcmds #7232
Conversation
Prior to this change, `cargo fix` had no defacto method for passing additional arguments down to rustc to use when generating warnings to be fixed. We did implement a way to do so for clippy, but the hack was inconsistent with the way all other sub commands get args for rustc, where they take all args after the -- and pass them down. This change removes the clippy args method as implemented earlier and adds a new primary_unit_args passing mechanism which will work for `cargo fix` and `cargo fix --clippy`.
r? @nrc (rust_highfive has picked a reviewer for you, use r? to override) |
@@ -132,6 +128,7 @@ pub fn fix(ws: &Workspace<'_>, opts: &mut FixOptions<'_>) -> CargoResult<()> { | |||
|
|||
let rustc = opts.compile_opts.config.load_global_rustc(Some(ws))?; | |||
wrapper.arg(&rustc.path); | |||
wrapper.args(&opts.primary_unit_args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass via wrapper's argument list. FixArgs::get()
already grabs all but a few special args and forwards them to the subprocess. This change just exposes that feature to the end user.
r? @ehuss |
@@ -586,7 +583,6 @@ struct FixArgs { | |||
enabled_edition: Option<String>, | |||
other: Vec<OsString>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The args are now being pushed into this list.
I don't think we want to allow passing arbitrary args to rustc in the |
Fwiw I didn't base it on |
Prior to this change,
cargo fix
had no defacto method for passingadditional arguments down to rustc to use when generating warnings to be
fixed. We did implement a way to do so for clippy, but the hack was
inconsistent with the way all other sub commands get args for rustc,
where they take all args after the -- and pass them down.
This change removes the clippy args method as implemented earlier and
adds a new primary_unit_args passing mechanism which will work for
cargo fix
andcargo fix --clippy
.