Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FN useless_format: write!(f,"{}",format!()) #3155

Closed
matthiaskrgr opened this issue Sep 9, 2018 · 2 comments
Closed

FN useless_format: write!(f,"{}",format!()) #3155

matthiaskrgr opened this issue Sep 9, 2018 · 2 comments
Labels
A-lint Area: New lints C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages I-false-negative Issue: The lint should have been triggered on code, but wasn't L-complexity Lint: Belongs in the complexity lint group

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Sep 9, 2018

        write!(
            f,
            "{}",
            format!(
                "Cargo cache '{}/':\n\n",
                &self.cargo_cache_paths.cargo_home.display()
            )
        )?;

should just be

        write!(
            f,
            "Cargo cache '{}/':\n\n",
            &self.cargo_cache_paths.cargo_home.display()
        )?;

but clippy doesn't warn apparently.
clippy 0.0.212 (cafef7b 2018-09-06)

@flip1995
Copy link
Member

This also applies to print!(), println!() and writeln!().

This could either be a new lint and would fit in clippy_lints/src/write.rs or an extension of the USELESS_FORMAT lint in clippy_lints/src/format.rs. Whatever seems easier to do.

@flip1995 flip1995 added C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages A-lint Area: New lints L-unnecessary Lint: Warn about unnecessary code L-complexity Lint: Belongs in the complexity lint group and removed L-unnecessary Lint: Warn about unnecessary code labels Sep 10, 2018
@matthiaskrgr matthiaskrgr added the I-false-negative Issue: The lint should have been triggered on code, but wasn't label Dec 18, 2020
@camsteffen
Copy link
Contributor

Added in #7743

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages I-false-negative Issue: The lint should have been triggered on code, but wasn't L-complexity Lint: Belongs in the complexity lint group
Projects
None yet
Development

No branches or pull requests

3 participants