rust-lang/rustfix

`fix --prepare-for 2018` doesn't fix test code

Closed this issue · 4 comments

doxxx commented

Running cargo fix --prepare-for 2018 doesn't touch code which is tagged #[cfg(test)]. More specifically, none of the use statements that reference crate-local modules are updated to use the new crate::mod paths.

This is currently "intentional" in that it's working as designed, but this can be fixed with cargo fix --prepare-for 2018 -- --all-targets. Now that being said it may be good to switch the defaults!

doxxx commented

What reason might one have for not fixing all targets?

Regardless, that option should at least show up in the cargo fix --help docs.

All options after -- are passed through to Cargo itself, but it'd be helpful to document for sure! Otherwise fixing all targets may be too aggressive sometimes or otherwise unexpected, but I do think, yes, that it'd be a good default as I can't think of many downsides.

I'm going to close this now that cargo fix is integrated into Cargo and --all-targets is a native flag. Additionally I've posted an update to the transition guide to recommend passing --all-targets by default as well