Skip to content

Some warnings are not reported if rust-src component is not installed #12837

@Disasm

Description

@Disasm

Summary

Some warnings are not reported when clippy is executed without the rust-src component installed. The same warnings are reported normally when the component is installed.

The issue was originally found in Docker environment which didn't contain any additional toolchain components.

Reproducer

I tried this code:

pub fn output(value: u32) {
    println!("{}", format!("{value}").to_string());
}

I expected to see this happen:

warning: `to_string` applied to a type that implements `Display` in `println!` args
   --> src/lib.rs:2:50
    |
2   |       println!("{}", format!("{value}").to_string());
    |  __________________________________________________^
3   | | }
...   |
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args
    = note: `#[warn(clippy::to_string_in_format_args)]` on by default

Instead, this happened: clippy doesn't issue any warnings.

Version

rustc 1.78.0 (9b00956e5 2024-04-29)
binary: rustc
commit-hash: 9b00956e56009bab2aa15d7bff10916599e3d6d6
commit-date: 2024-04-29
host: x86_64-unknown-linux-gnu
release: 1.78.0
LLVM version: 18.1.2
(same compiler was used on the host and inside docker)

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