Skip to content

clippy --fix deleting informational comments #13692

Closed
@swanandx

Description

@swanandx

Summary

running clippy --fix is deleting comments while fixing useless_vec lint. I think this might be similar to #8528 ( not sure about the fix implementation though )

ps: i would love to work on the fix if I can get little pointers! thanks :)

Reproducer

I tried this code:

let _some_variable = vec![
    1, 2, // i'm here to stay
    3, 4, // but this one going away ;-;
]; // that is life anyways

I expected to see this happen:

let _some_variable = [1, 2, // i'm here to stay
      3, 4]; // but this one going away ;-;
// that is life anyways

Instead, this happened:

let _some_variable = [1, 2, // i'm here to stay
      3, 4]; // that is life anyways

Version

rustc 1.82.0 (f6e511eec 2024-10-15)
binary: rustc
commit-hash: f6e511eec7342f59a25f7c0534f1dbea00d01b14
commit-date: 2024-10-15
host: aarch64-apple-darwin
release: 1.82.0
LLVM version: 19.1.1

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions