Skip to content

Various regressions in useless_format and other lints after rust update #4432

Closed
@phansch

Description

@phansch

I don't know which Rust PR caused these changes unfortunately.

From Travis: https://travis-ci.com/rust-lang/rust-clippy/jobs/227296639#L1078

useless_format

The following 3 examples in useless_format are not linted anymore:

diff of stderr:
 error: useless use of `format!`
-  --> $DIR/format.rs:13:5
-   |
-LL |     format!("foo");
-   |     ^^^^^^^^^^^^^^^ help: consider using .to_string(): `"foo".to_string();`
-   |
-   = note: `-D clippy::useless-format` implied by `-D warnings`
-
-error: useless use of `format!`
-  --> $DIR/format.rs:14:5
-   |
-LL |     format!("{{}}");
-   |     ^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"{}".to_string();`
-
-error: useless use of `format!`
-  --> $DIR/format.rs:15:5
-   |
-LL |     format!("{{}} abc {{}}");
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using .to_string(): `"{} abc {}".to_string();`
-

zero_width_space, unicode_not_nfc, non_ascii_literal

The stderr files of zero_width_space, non_ascii_literal can probably just be updated, but the suggestion for unicode_not_nfc seems incorrect?

 error: zero-width space detected
   --> $DIR/unicode.rs:3:12
    |
 LL |     print!("Here >​< is a ZWS, and ​another");
-   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider replacing the string with: `"Here >/u{200B}< is a ZWS, and /u{200B}another"`
    |
    = note: `-D clippy::zero-width-space` implied by `-D warnings`

 error: non-nfc unicode sequence detected
   --> $DIR/unicode.rs:9:12
    |
 LL |     print!("̀àh?");
-   |            ^^^^^
+   |            ^^^^^ help: consider replacing the string with: `"̀àh?"`
    |
    = note: `-D clippy::unicode-not-nfc` implied by `-D warnings`
 error: literal non-ASCII character detected
   --> $DIR/unicode.rs:15:12
    |
 LL |     print!("Üben!");
-   |            ^^^^^^^
+   |            ^^^^^^^ help: consider replacing the string with: `"/u{dc}ben!"`
    |
    = note: `-D clippy::non-ascii-literal` implied by `-D warnings`

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