Skip to content
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

Clean up imports and crate attributes #26

Merged
merged 1 commit into from
Mar 19, 2020

Conversation

Inityx
Copy link

@Inityx Inityx commented Mar 18, 2020

The imports in most files appear to have been incompletely converted from edition 2015 to edition 2018, with some duplicates and repeated prefixes. Additionally, some crate attributes were set separately when they could have been set jointly.

This change cleans up imports and consolidates crate attributes. Some import sections have been annotated #[rustfmt::skip] and manually formatted for readability.

@Inityx
Copy link
Author

Inityx commented Mar 18, 2020

It appears that the rustfmt imports_layout config is only available on nightly. The default formatting mode produces undesirable output, so that stabilization should be considered a blocker for this PR unless the repository owners are willing to #[rustfmt::skip] imports.

@dtwood
Copy link
Collaborator

dtwood commented Mar 18, 2020

Thanks for the MR, all LGTM although it's a shame that we can't merge because of an unstable rustfmt feature.

Looking through the diffs from the rustfmt check, I don't actually find the version without imports_layout too bad, so would be happy for you to either push again after removing the config and re-running rustfmt, or to add #[rustfmt::skip] to the places that need it.

Two other things that I think should be possible if you want to add them:

  • extern crate panic_halt -> use panic_halt as _
  • pub use crate::gpio::GpioExt as _tm4c123x_hal_gpio_GpioExt -> pub use crate::gpio::GpioExt as _

The imports in most files appear to have been incompletely converted from
edition 2015 to edition 2018, with duplicates and repeated prefixes.
Additionally, some crate attributes were set separately when they could have
been set jointly.

This change cleans up imports and consolidates crate attributes.
Some import sections have been annotated `#[rustfmt::skip]` and manually
formatted for readability.
@Inityx
Copy link
Author

Inityx commented Mar 19, 2020

I have applied your recommendations, and am happy with the formatting I landed on. 😃
Also TIL that use x as _; can replace extern crate x; in link-only scenarios!

@dtwood dtwood merged commit c6f576f into rust-embedded-community:master Mar 19, 2020
@dtwood
Copy link
Collaborator

dtwood commented Mar 19, 2020

Thanks again for the MR, merged :-)

@Inityx Inityx deleted the cleanup-use branch March 20, 2020 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants