Skip to content

cargo-fix: what kind of things can be fixed? #5846

Closed
@eminence

Description

@eminence

I'm trying out cargo fix to see what kind of stuff it can fix, and I'm a little surprised that it doesn't fix some trivial stuff that looks easy to handle. Some examples:

warning: unused import: `std::io`
 --> src/lib.rs:4:9
  |
4 |     use std::io;
  |         ^^^^^^^
warning: variable `BAD_NAME` should have a snake case name such as `bad_name`
 --> src/lib.rs:8:9
  |
8 |     let BAD_NAME = v.len();
  |         ^^^^^^^^
warning: variable does not need to be mutable
 --> src/lib.rs:6:9
  |
6 |     let mut v: Vec<u8> = Vec::new();
  |         ----^
  |         |
  |         help: remove this `mut`
warning: unnecessary parentheses around `return` value
 --> src/lib.rs:9:12
  |
9 |     return (BAD_NAME + 1)
  |            ^^^^^^^^^^^^^^ help: remove these parentheses

Do you expect that cargo fix will eventually be able to make these types of fixes automatically?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions