Skip to content

cargo clippy does not lint tests, code in bin/ but cargo clippy --fix does #12811

@Kriskras99

Description

@Kriskras99

Summary

This might be a configuration error on my part, but it confuses my that it does work with --fix.
(I do want Clippy to lint tests and everything)

To reproduce:

git clone https://github.com/Kriskras99/ferris_dancing.git
cd ferris_dancing
git checkout acd683a
cargo +nightly clippy
cargo +nigthly clippy --fix

Reproducer

See the repository for code

I expected to see this happen:

warning: used binding `_ctx` which is prefixed with an underscore. A leading underscore signals that a binding will not be used
  --> ubiart_toolkit/src/cooked/xtx/parser.rs:30:9
   |
30 |         _ctx: (),
   |         ^^^^
   |
note: `_ctx` is defined here
  --> ubiart_toolkit/src/cooked/xtx/parser.rs:30:9
   |
30 |         _ctx: (),
   |         ^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#used_underscore_binding
   = note: `-W clippy::used-underscore-binding` implied by `-W clippy::pedantic`
   = help: to override `-W clippy::pedantic` add `#[allow(clippy::used_underscore_binding)]`

warning: `ubiart_toolkit` (lib) generated 1 warning
    Checking dotstar_toolkit_utils v0.2.0 (/home/kriskras99/Source/ferris_dancing/dotstar_toolkit_utils)
   Compiling rgbcx-sys v1.12.0 (/home/kriskras99/Source/ferris_dancing/rgbcx-sys)
warning: field `song_name` is never read
  --> jdmod/src/types/song.rs:40:5
   |
26 | pub struct SongDirectoryTree {
   |            ----------------- field in this struct
...
40 |     song_name: String,
   |     ^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

    Checking jdmod v0.2.0 (/home/kriskras99/Source/ferris_dancing/jdmod)
    Checking ubiart_toolkit v0.2.0 (/home/kriskras99/Source/ferris_dancing/ubiart_toolkit)
warning: `jdmod` (lib) generated 1 warning
    Checking wii_toolkit v0.2.0 (/home/kriskras99/Source/ferris_dancing/wii_toolkit)
warning: docs for function which may panic missing `# Panics` section
  --> ubiart_toolkit/src/bin/jsontool.rs:14:1
   |
14 | fn main() {
   | ^^^^^^^^^
   |
note: first possible panic found here
  --> ubiart_toolkit/src/bin/jsontool.rs:25:14
   |
25 |         _ => panic!("Unrecognized game version: {}", cli.game),
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
   = note: requested on the command line with `-D clippy::missing-panics-doc`

warning: `ubiart_toolkit` (bin "jsontool" test) generated 1 warning
warning: docs for function which may panic missing `# Panics` section
   --> jdmod/src/types/localisation.rs:401:5
    |
401 |     fn test_is_empty() {
    |     ^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> jdmod/src/types/localisation.rs:403:9
    |
403 |         assert!(translation.is_empty());
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
    = note: requested on the command line with `-D clippy::missing-panics-doc`

warning: `jdmod` (lib test) generated 2 warnings (1 duplicate)
warning: docs for function which may panic missing `# Panics` section
   --> wii_toolkit/src/wad/parser.rs:310:5
    |
310 |     fn test_rounding() {
    |     ^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> wii_toolkit/src/wad/parser.rs:311:9
    |
311 |         assert_eq!(round_to_boundary_u64(0x0), 0x0);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
    = note: requested on the command line with `-D clippy::missing-panics-doc`

warning: `wii_toolkit` (lib test) generated 1 warning
warning: docs for function which may panic missing `# Panics` section
  --> ubiart_toolkit/src/bin/msmtool.rs:19:1
   |
19 | fn main() {
   | ^^^^^^^^^
   |
note: first possible panic found here
  --> ubiart_toolkit/src/bin/msmtool.rs:22:16
   |
22 |     let file = File::open(cli.source).unwrap();
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
   = note: requested on the command line with `-D clippy::missing-panics-doc`

warning: `ubiart_toolkit` (bin "msmtool" test) generated 1 warning
warning: docs for function which may panic missing `# Panics` section
  --> wii_toolkit/src/bin/u8tool.rs:16:1
   |
16 | fn main() {
   | ^^^^^^^^^
   |
note: first possible panic found here
  --> wii_toolkit/src/bin/u8tool.rs:27:16
   |
27 |     let file = File::open(source).unwrap();
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
   = note: requested on the command line with `-D clippy::missing-panics-doc`

warning: `wii_toolkit` (bin "u8tool" test) generated 1 warning
warning: `ubiart_toolkit` (lib) generated 1 warning (1 duplicate)
warning: docs for function which may panic missing `# Panics` section
  --> wii_toolkit/src/bin/wadtool.rs:16:1
   |
16 | fn main() {
   | ^^^^^^^^^
   |
note: first possible panic found here
  --> wii_toolkit/src/bin/wadtool.rs:27:16
   |
27 |     let file = File::open(source).unwrap();
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
   = note: requested on the command line with `-D clippy::missing-panics-doc`

warning: `wii_toolkit` (bin "wadtool" test) generated 1 warning
    Checking rgbcx v0.1.0 (/home/kriskras99/Source/ferris_dancing/rgbcx)
warning: docs for function which may panic missing `# Panics` section
  --> ubiart_toolkit/src/bin/isctool.rs:14:1
   |
14 | fn main() {
   | ^^^^^^^^^
   |
note: first possible panic found here
  --> ubiart_toolkit/src/bin/isctool.rs:18:16
   |
18 |     let data = read_to_vec(&path).unwrap();
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
   = note: requested on the command line with `-D clippy::missing-panics-doc`

warning: `ubiart_toolkit` (bin "isctool" test) generated 1 warning
warning: docs for function which may panic missing `# Panics` section
  --> ubiart_toolkit/src/bin/sfattool.rs:20:1
   |
20 | fn main() {
   | ^^^^^^^^^
   |
note: first possible panic found here
  --> ubiart_toolkit/src/bin/sfattool.rs:23:16
   |
23 |     let file = File::open(cli.source).unwrap();
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
   = note: requested on the command line with `-D clippy::missing-panics-doc`

warning: `ubiart_toolkit` (bin "sfattool" test) generated 1 warning
warning: docs for function which may panic missing `# Panics` section
  --> ubiart_toolkit/src/bin/alias8tool.rs:13:1
   |
13 | fn main() {
   | ^^^^^^^^^
   |
note: first possible panic found here
  --> ubiart_toolkit/src/bin/alias8tool.rs:16:16
   |
16 |     let file = File::open(cli.source).unwrap();
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
   = note: requested on the command line with `-D clippy::missing-panics-doc`

warning: `ubiart_toolkit` (bin "alias8tool" test) generated 1 warning
warning: `jdmod` (lib) generated 1 warning (1 duplicate)
    Checking rgbcx-rs v0.1.0 (/home/kriskras99/Source/ferris_dancing/rgbcx-rs)
warning: docs for function which may panic missing `# Panics` section
   --> rgbcx-rs/src/lib.rs:202:5
    |
202 |     fn test_unpack_bc1_fuzz_1() {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> rgbcx-rs/src/lib.rs:206:9
    |
206 | /         assert_eq!(
207 | |             &pixels,
208 | |             &[
209 | |                 Rgba([8, 67, 79, 0]),
...   |
225 | |             ]
226 | |         );
    | |_________^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
    = note: requested on the command line with `-D clippy::missing-panics-doc`

warning: docs for function which may panic missing `# Panics` section
   --> rgbcx-rs/src/lib.rs:230:5
    |
230 |     fn test_unpack_bc1_fuzz_2() {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> rgbcx-rs/src/lib.rs:234:9
    |
234 | /         assert_eq!(
235 | |             &pixels,
236 | |             &[
237 | |                 Rgba([132, 0, 82, 0]),
...   |
253 | |             ]
254 | |         );
    | |_________^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

warning: docs for function which may panic missing `# Panics` section
   --> rgbcx-rs/src/lib.rs:258:5
    |
258 |     fn test_unpack_bc1_fuzz_3() {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> rgbcx-rs/src/lib.rs:262:9
    |
262 | /         assert_eq!(
263 | |             &pixels,
264 | |             &[
265 | |                 Rgba([156, 130, 82, 0]),
...   |
281 | |             ]
282 | |         );
    | |_________^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

warning: docs for function which may panic missing `# Panics` section
   --> rgbcx-rs/src/lib.rs:286:5
    |
286 |     fn test_unpack_bc1_fuzz_4() {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> rgbcx-rs/src/lib.rs:290:9
    |
290 | /         assert_eq!(
291 | |             &pixels,
292 | |             &[
293 | |                 Rgba([156, 130, 82, 255]),
...   |
309 | |             ]
310 | |         );
    | |_________^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

warning: docs for function which may panic missing `# Panics` section
   --> rgbcx-rs/src/lib.rs:314:5
    |
314 |     fn test_unpack_bc3_fuzz_1() {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> rgbcx-rs/src/lib.rs:317:9
    |
317 |         assert!(unpack_bc3_mut(&data, &mut pixels).is_err());
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

warning: docs for function which may panic missing `# Panics` section
   --> rgbcx-rs/src/lib.rs:321:5
    |
321 |     fn test_unpack_bc3_fuzz_2() {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> rgbcx-rs/src/lib.rs:326:9
    |
326 |         assert!(unpack_bc3_mut(&data, &mut pixels).is_ok());
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

warning: docs for function which may panic missing `# Panics` section
   --> rgbcx-rs/src/lib.rs:351:5
    |
351 |     fn test_unpack_bc3_fuzz_3() {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> rgbcx-rs/src/lib.rs:356:9
    |
356 |         assert!(unpack_bc3_mut(&data, &mut pixels).is_ok());
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

warning: `rgbcx-rs` (lib test) generated 7 warnings
warning: docs for function which may panic missing `# Panics` section
  --> ubiart_toolkit/src/bin/acttool.rs:19:1
   |
19 | fn main() {
   | ^^^^^^^^^
   |
note: first possible panic found here
  --> ubiart_toolkit/src/bin/acttool.rs:30:14
   |
30 |         _ => panic!("Unrecognized game version: {}", cli.game),
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
   = note: requested on the command line with `-D clippy::missing-panics-doc`

warning: `ubiart_toolkit` (bin "acttool" test) generated 1 warning
warning: docs for function which may panic missing `# Panics` section
  --> ubiart_toolkit/src/bin/sgstool.rs:13:1
   |
13 | fn main() {
   | ^^^^^^^^^
   |
note: first possible panic found here
  --> ubiart_toolkit/src/bin/sgstool.rs:16:16
   |
16 |     let data = read_to_vec(path).unwrap();
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
   = note: requested on the command line with `-D clippy::missing-panics-doc`

warning: `ubiart_toolkit` (bin "sgstool" test) generated 1 warning
warning: docs for function which may panic missing `# Panics` section
   --> ubiart_toolkit/src/utils/mod.rs:731:5
    |
731 |     fn test_string_id() {
    |     ^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> ubiart_toolkit/src/utils/mod.rs:732:9
    |
732 | /         assert_eq!(
733 | |             string_id("world/maps/adoreyou/videoscoach/adoreyou.vp9.720.webm"),
734 | |             0x45CC_A9CA
735 | |         );
    | |_________^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
    = note: requested on the command line with `-D clippy::missing-panics-doc`

warning: docs for function which may panic missing `# Panics` section
   --> ubiart_toolkit/src/utils/mod.rs:739:5
    |
739 |     fn test_splitpath_try_from_path() {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> ubiart_toolkit/src/utils/mod.rs:741:18
    |
741 |         let sp = SplitPath::try_from(path.as_path()).unwrap();
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

warning: docs for function which may panic missing `# Panics` section
   --> ubiart_toolkit/src/utils/mod.rs:746:5
    |
746 |     fn test_splitpath_starts_with() {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> ubiart_toolkit/src/utils/mod.rs:747:26
    |
747 |           let split_path = SplitPath::new(
    |  __________________________^
748 | |             Cow::Borrowed("cache/itf_cooked/nx/"),
749 | |             Cow::Borrowed("atlascontainer.ckd"),
750 | |         )
751 | |         .unwrap();
    | |_________________^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

warning: `ubiart_toolkit` (lib test) generated 4 warnings (1 duplicate)
warning: docs for function which may panic missing `# Panics` section
  --> ubiart_toolkit/src/bin/loc8tool.rs:15:1
   |
15 | fn main() {
   | ^^^^^^^^^
   |
note: first possible panic found here
  --> ubiart_toolkit/src/bin/loc8tool.rs:18:16
   |
18 |     let file = File::open(cli.source).unwrap();
   |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
   = note: requested on the command line with `-D clippy::missing-panics-doc`

warning: `ubiart_toolkit` (bin "loc8tool" test) generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 51.79s

Instead, this happened:

    Checking dotstar_toolkit_utils v0.2.0 (/home/kriskras99/Source/ferris_dancing/dotstar_toolkit_utils)
   Compiling rgbcx-sys v1.12.0 (/home/kriskras99/Source/ferris_dancing/rgbcx-sys)
    Checking ubiart_toolkit v0.2.0 (/home/kriskras99/Source/ferris_dancing/ubiart_toolkit)
    Checking wii_toolkit v0.2.0 (/home/kriskras99/Source/ferris_dancing/wii_toolkit)
    Checking rgbcx v0.1.0 (/home/kriskras99/Source/ferris_dancing/rgbcx)
    Checking rgbcx-rs v0.1.0 (/home/kriskras99/Source/ferris_dancing/rgbcx-rs)
warning: used binding `_ctx` which is prefixed with an underscore. A leading underscore signals that a binding will not be used
  --> ubiart_toolkit/src/cooked/xtx/parser.rs:30:9
   |
30 |         _ctx: (),
   |         ^^^^
   |
note: `_ctx` is defined here
  --> ubiart_toolkit/src/cooked/xtx/parser.rs:30:9
   |
30 |         _ctx: (),
   |         ^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#used_underscore_binding
   = note: `-W clippy::used-underscore-binding` implied by `-W clippy::pedantic`
   = help: to override `-W clippy::pedantic` add `#[allow(clippy::used_underscore_binding)]`

warning: `ubiart_toolkit` (lib) generated 1 warning
    Checking jdmod v0.2.0 (/home/kriskras99/Source/ferris_dancing/jdmod)
warning: field `song_name` is never read
  --> jdmod/src/types/song.rs:40:5
   |
26 | pub struct SongDirectoryTree {
   |            ----------------- field in this struct
...
40 |     song_name: String,
   |     ^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: `jdmod` (lib) generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 40.65s

Version

rustc 1.80.0-nightly (1871252fc 2024-05-15)
binary: rustc
commit-hash: 1871252fc8bb672d40787e67404e6eaae7059369
commit-date: 2024-05-15
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.4

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