Skip to content

Clippy can not fix the following issues #14120

Open
@iajoiner

Description

@iajoiner

Summary

iajoiner@iajoiner-HP-Spectre-x360-2-in-1-Laptop-16-f1xxx:~/Documents/projects/sxt-proof-of-sql$ cargo clippy --fix --lib -p proof-of-sql
    Checking proof-of-sql v0.0.0 (/home/iajoiner/Documents/projects/sxt-proof-of-sql/crates/proof-of-sql)
warning: failed to automatically apply fixes suggested by rustc to crate `proof_of_sql`

after fixes were automatically applied the compiler reported errors within these files:

  * crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs

This likely indicates a bug in either rustc or cargo itself,
and we would appreciate a bug report! You're likely to see
a number of compiler warnings after this message which cargo
attempted to fix but failed. If you could open an issue at
https://github.com/rust-lang/rust-clippy/issues
quoting the full output of this command we'd be very appreciative!
Note that you may be able to make some more progress in the near-term
fixing code with the `--broken-code` flag

The following errors were reported:
error[E0603]: module `column` is private
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:277:41
    |
277 |             .map(crate::base::database::column::ColumnField::data_type)
    |                                         ^^^^^^ private module
    |
note: the module `column` is defined here
   --> crates/proof-of-sql/src/base/database/mod.rs:7:1
    |
7   | mod column;
    | ^^^^^^^^^^^
help: consider importing this struct through its public re-export instead
    |
277 |             .map(crate::base::database::ColumnField::data_type)
    |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0603`.
Original diagnostics will follow.

warning: item in documentation is missing backticks
   --> crates/proof-of-sql/src/base/database/join_util.rs:144:32
    |
144 | /// The results are sorted by (left_index, right_index).
    |                                ^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
    = note: `-W clippy::doc-markdown` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::doc_markdown)]`
help: try
    |
144 | /// The results are sorted by (`left_index`, right_index).
    |                                ~~~~~~~~~~~~

warning: item in documentation is missing backticks
   --> crates/proof-of-sql/src/base/database/join_util.rs:144:44
    |
144 | /// The results are sorted by (left_index, right_index).
    |                                            ^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
    |
144 | /// The results are sorted by (left_index, `right_index`).
    |                                            ~~~~~~~~~~~~~

warning: only a `panic!` in `if`-then statement
  --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:76:9
   |
76 | /         if num_join_columns != right_join_column_indexes.len() {
77 | |             panic!("Join columns should have the same number of columns");
78 | |         }
   | |_________^ help: try instead: `assert!(!(num_join_columns != right_join_column_indexes.len()), "Join columns should have the same number of columns");`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_assert
   = note: `-W clippy::manual-assert` implied by `-W clippy::pedantic`
   = help: to override `-W clippy::pedantic` add `#[allow(clippy::manual_assert)]`

warning: only a `panic!` in `if`-then statement
  --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:79:9
   |
79 | /         if result_idents.len() != num_columns_left + num_columns_right - num_join_columns {
80 | |             panic!(
81 | |                 "The amount of result idents should be the same as the expected number of columns"
82 | |             );
83 | |         }
   | |_________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_assert
help: try instead
   |
79 ~         assert!(!(result_idents.len() != num_columns_left + num_columns_right - num_join_columns), 
80 +                 "The amount of result idents should be the same as the expected number of columns"
81 +             );
   |

warning: an inclusive range would be more readable
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:153:17
    |
153 |                 (0..num_columns_left + 1).filter(|i| !self.left_join_column_indexes.contains(&i)),
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(0..=num_columns_left)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#range_plus_one
    = note: `-W clippy::range-plus-one` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::range_plus_one)]`

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:153:94
    |
153 |                 (0..num_columns_left + 1).filter(|i| !self.left_join_column_indexes.contains(&i)),
    |                                                                                              ^^ help: change this to: `i`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
    = note: `#[warn(clippy::needless_borrow)]` on by default

warning: an inclusive range would be more readable
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:161:17
    |
161 |                 (0..num_columns_right + 1).filter(|i| !self.right_join_column_indexes.contains(&i)),
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(0..=num_columns_right)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#range_plus_one

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:161:96
    |
161 |                 (0..num_columns_right + 1).filter(|i| !self.right_join_column_indexes.contains(&i)),
    |                                                                                                ^^ help: change this to: `i`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

warning: an inclusive range would be more readable
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:170:41
    |
170 |         let tilde_left_column_indexes = (0..num_columns_left + 1).collect::<Vec<_>>();
    |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(0..=num_columns_left)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#range_plus_one

warning: redundant closure
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:281:18
    |
281 |             .map(|f| f.data_type())
    |                  ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `crate::base::database::column::ColumnField::data_type`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls
    = note: `-W clippy::redundant-closure-for-method-calls` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::redundant_closure_for_method_calls)]`

warning: only a `panic!` in `if`-then statement
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:360:9
    |
360 | /         if u.len() != 1 {
361 | |             panic!("Join on multiple columns not supported yet");
362 | |         }
    | |_________^ help: try instead: `assert!(!(u.len() != 1), "Join on multiple columns not supported yet");`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_assert

warning: an inclusive range would be more readable
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:377:17
    |
377 |                 (0..num_columns_left + 1).filter(|i| !self.left_join_column_indexes.contains(&i)),
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(0..=num_columns_left)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#range_plus_one

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:377:94
    |
377 |                 (0..num_columns_left + 1).filter(|i| !self.left_join_column_indexes.contains(&i)),
    |                                                                                              ^^ help: change this to: `i`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

warning: an inclusive range would be more readable
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:385:17
    |
385 |                 (0..num_columns_right + 1).filter(|i| !self.right_join_column_indexes.contains(&i)),
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(0..=num_columns_right)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#range_plus_one

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:385:96
    |
385 |                 (0..num_columns_right + 1).filter(|i| !self.right_join_column_indexes.contains(&i)),
    |                                                                                                ^^ help: change this to: `i`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

warning: an inclusive range would be more readable
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:392:47
    |
392 |         let tilde_left_columns = enhanced_res[0..num_columns_left + 1].to_vec();
    |                                               ^^^^^^^^^^^^^^^^^^^^^^^ help: use: `0..=num_columns_left`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#range_plus_one

warning: used `cloned` where `copied` could be used instead
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:396:14
    |
396 |             .cloned()
    |              ^^^^^^ help: try: `copied`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cloned_instead_of_copied
    = note: `-W clippy::cloned-instead-of-copied` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::cloned_instead_of_copied)]`

warning: it is more concise to loop over references to containers instead of using explicit iteration methods
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:509:23
    |
509 |         for column in alloc_enhanced_res.iter() {
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&alloc_enhanced_res`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop
    = note: `-W clippy::explicit-iter-loop` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::explicit_iter_loop)]`

warning: an inclusive range would be more readable
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:522:20
    |
522 |             .chain((0..num_columns_left + 1).filter(|i| !self.left_join_column_indexes.contains(i)))
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(0..=num_columns_left)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#range_plus_one

warning: an inclusive range would be more readable
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:529:17
    |
529 |                 (0..num_columns_right + 1).filter(|i| !self.right_join_column_indexes.contains(i)),
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(0..=num_columns_right)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#range_plus_one

warning: an inclusive range would be more readable
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:538:47
    |
538 |         let tilde_left_columns = enhanced_res[0..num_columns_left + 1].to_vec();
    |                                               ^^^^^^^^^^^^^^^^^^^^^^^ help: use: `0..=num_columns_left`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#range_plus_one

warning: used `cloned` where `copied` could be used instead
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:542:14
    |
542 |             .cloned()
    |              ^^^^^^ help: try: `copied`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cloned_instead_of_copied

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> crates/proof-of-sql/src/sql/proof_plans/sort_merge_join_exec.rs:591:50
    |
591 |         let res_columns = apply_slice_to_indexes(&enhanced_res, &res_column_indexes)
    |                                                  ^^^^^^^^^^^^^ help: change this to: `enhanced_res`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

warning: `proof-of-sql` (lib) generated 23 warnings (run `cargo clippy --fix --lib -p proof-of-sql` to apply 16 suggestions)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 10.78s

Reproducer

My code is open source so you can reproduce the bug by going to
https://github.com/spaceandtimelabs/sxt-proof-of-sql/tree/1980d69c7e1164ca901db2b1d301d7c895110765
Run cargo clippy --fix --lib -p proof-of-sql

Version

iajoiner@iajoiner-HP-Spectre-x360-2-in-1-Laptop-16-f1xxx:~/Documents/projects/sxt-proof-of-sql$ rustc --version --verbose
rustc 1.84.0 (9fc6b4312 2025-01-07)
binary: rustc
commit-hash: 9fc6b43126469e3858e2fe86cafb4f0fd5068869
commit-date: 2025-01-07
host: x86_64-unknown-linux-gnu
release: 1.84.0
LLVM version: 19.1.5

Additional Labels

P.S. rustc -vv in the description doesn't work and should be replace with rustc --version --verbose instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when applied

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions