Skip to content

unused imports should not be fixed from use foo;\n to \n #66560

Description

@samuela

Right now rustfix fixes unused imports by removing but instead of replacing an unused import use foo;\n with ``, it inserts \n. This gets really annoying when you have a single block of imports and it ends up looking "hole punched":

use crate::archival::libarchive::bb_archive::file_header_t;
use crate::libbb::llist::llist_t;


use crate::librb::bb_uidgid_t;
use crate::librb::fd_pair;
use crate::librb::size_t;
use crate::librb::uoff_t;

use libc;
use libc::close;
use libc::fprintf;
use libc::free;

use libc::gid_t;
use libc::lstat;
use libc::mode_t;
use libc::off_t;
use libc::pid_t;

use libc::printf;
use libc::stat;

use libc::strcpy;
use libc::uid_t;
use libc::FILE;

On its own this wouldn't be that big of a deal but since these have now been split into separate import "blocks" rustfmt will no longer condense them.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.D-papercutDiagnostics: An error or lint that needs small tweaks.E-help-wantedCall for participation: Help is requested to fix this issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions