Skip to content

Diagnostic information does not include item attributes #54400

Closed
@jrobsonchase

Description

@jrobsonchase

Original rustfix issue: rust-lang/rustfix#147

When rustc outputs warnings like "you don't need this extern crate line anymore, delete it," it doesn't include accompanying attributes. This leads rustfix to apply its suggestion to delete the extern crate line, but leave the attribute, which then gets applied to the next item.

For example:

#[cfg(unix)]
extern crate nix;

mod foo;

becomes

#[cfg(unix)]

mod foo;

which applies the #[cfg(unix)] attribute to mod foo; which is definitely not what was desired.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-edition-2018Area: The 2018 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions