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

Clippy/lints not running in CI for all platforms that aren't stable ubuntu-latest #10375

Open
RossSmyth opened this issue Apr 12, 2024 · 3 comments
Labels
A-packaging Area: Packaging and bundling O-windows Operating system: Windows

Comments

@RossSmyth
Copy link
Contributor

RossSmyth commented Apr 12, 2024

Currently lints are only being ran in CI for Linux stable. This is a common issue for projects, but would be good to see other platforms checked in CI. Currently many lints/warnings are emitted on Windows. It would also be good to check nightly or even latest stable in CI as well to be proactive.

Currently lints are emitted on Windows with MSRV:

warning: the function `MapGenericMask` doesn't need a mutable reference
   --> helix-stdx\src\faccess.rs:300:44
    |
300 |         unsafe { MapGenericMask(&mut mode, &mut mapping) };
    |                                            ^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
    = note: `#[warn(clippy::unnecessary_mut_passed)]` on by default

warning: the function `AccessCheck` doesn't need a mutable reference
   --> helix-stdx\src\faccess.rs:307:17
    |
307 |                 &mut mapping,
    |                 ^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed

warning: `helix-stdx` (lib) generated 2 warnings
warning: `helix-stdx` (lib) generated 2 warnings (2 duplicates)
warning: unneeded `return` statement
  --> helix-term\build.rs:70:17
   |
70 | /                 return Err(io::Error::new(
71 | |                     io::ErrorKind::Other,
72 | |                     format!("Failed to run registry query: {}", find_reg_key),
73 | |                 ))
   | |__________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
   = help: remove `return`

warning: unneeded `return` statement
  --> helix-term\build.rs:77:21
   |
77 | /                     return Err(io::Error::new(
78 | |                         io::ErrorKind::Other,
79 | |                         "Can not find Windows SDK",
80 | |                     ));
   | |______________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = help: remove `return`

warning: `helix-term` (build script) generated 2 warnings

And on the latest stable (1.77.2) many many more lints are emitted

Click me
warning: the function `MapGenericMask` doesn't need a mutable reference
   --> helix-stdx\src\faccess.rs:300:44
    |
300 |         unsafe { MapGenericMask(&mut mode, &mut mapping) };
    |                                            ^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
    = note: `#[warn(clippy::unnecessary_mut_passed)]` on by default

warning: the function `AccessCheck` doesn't need a mutable reference
   --> helix-stdx\src\faccess.rs:307:17
    |
307 |                 &mut mapping,
    |                 ^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed

warning: `helix-stdx` (lib) generated 2 warnings
warning: accessing first element with `pred.args.get(0)`
   --> helix-core\src\indent.rs:483:42
    |
483 |                 "not-kind-eq?" => match (pred.args.get(0), pred.args.get(1)) {
    |                                          ^^^^^^^^^^^^^^^^ help: try: `pred.args.first()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
    = note: `#[warn(clippy::get_first)]` on by default

warning: accessing first element with `pred.args.get(0)`
   --> helix-core\src\indent.rs:499:28
    |
499 |                     match (pred.args.get(0), pred.args.get(1)) {
    |                            ^^^^^^^^^^^^^^^^ help: try: `pred.args.first()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first

warning: accessing first element with `pred.args.get(0)`
   --> helix-core\src\indent.rs:521:56
    |
521 |                 "one-line?" | "not-one-line?" => match pred.args.get(0) {
    |                                                        ^^^^^^^^^^^^^^^^ help: try: `pred.args.first()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first

warning: use of `unwrap_or_else` to construct default value
   --> helix-core\src\indent.rs:766:54
    |
766 |             let mut cursor = ts_parser.cursors.pop().unwrap_or_else(QueryCursor::new);
    |                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
    = note: `#[warn(clippy::unwrap_or_default)]` on by default

warning: use of `format!` to build up a string from an iterator
   --> helix-core\src\syntax.rs:729:13
    |
729 | /             captures[1]
730 | |                 .split(',')
731 | |                 .map(|language| format!("\n{}\n", read_query(language, filename)))
732 | |                 .collect::<String>()
    | |____________________________________^
    |
help: call `fold` instead
   --> helix-core\src\syntax.rs:731:18
    |
731 |                 .map(|language| format!("\n{}\n", read_query(language, filename)))
    |                  ^^^
help: ... and use the `write!` macro here
   --> helix-core\src\syntax.rs:731:33
    |
731 |                 .map(|language| format!("\n{}\n", read_query(language, filename)))
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this can be written more efficiently by appending to a `String` directly
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#format_collect
    = note: `#[warn(clippy::format_collect)]` on by default

warning: use of `unwrap_or_else` to construct default value
    --> helix-core\src\syntax.rs:1247:54
     |
1247 |             let mut cursor = ts_parser.cursors.pop().unwrap_or_else(QueryCursor::new);
     |                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default

warning: use of `unwrap_or_else` to construct default value
    --> helix-core\src\syntax.rs:1421:47
     |
1421 |                     highlighter.cursors.pop().unwrap_or_else(QueryCursor::new)
     |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default

warning: try not to call a closure in the expression where it is declared
   --> helix-core\src\transaction.rs:408:45
    |
408 |                           let Some(new_pos) = $map(**pos, *assoc) else { break; };
    |                                               ^^^^^^^^^^^^^^^^^^^
...
416 | /                 map!(
417 | |                     |pos, _| (old_pos == pos).then_some(new_pos),
418 | |                     self.changes.len()
419 | |                 );
    | |_________________- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_call
    = note: `#[warn(clippy::redundant_closure_call)]` on by default
    = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: try not to call a closure in the expression where it is declared
   --> helix-core\src\transaction.rs:408:45
    |
408 |                           let Some(new_pos) = $map(**pos, *assoc) else { break; };
    |                                               ^^^^^^^^^^^^^^^^^^^
...
431 | /                     map!(
432 | |                         |pos, _| (old_end > pos).then_some(new_pos + (pos - old_pos)),
433 | |                         i
434 | |                     );
    | |_____________________- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_call
    = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: try not to call a closure in the expression where it is declared
   --> helix-core\src\transaction.rs:408:45
    |
408 |                         let Some(new_pos) = $map(**pos, *assoc) else { break; };
    |                                             ^^^^^^^^^^^^^^^^^^^
...
439 |                     map!(|pos, _| (old_end > pos).then_some(new_pos), i);
    |                     ---------------------------------------------------- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_call
    = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: try not to call a closure in the expression where it is declared
   --> helix-core\src\transaction.rs:408:45
    |
408 |                           let Some(new_pos) = $map(**pos, *assoc) else { break; };
    |                                               ^^^^^^^^^^^^^^^^^^^
...
448 | /                         map!(
449 | |                             |pos, assoc: Assoc| (old_end > pos).then(|| {
450 | |                                 // at point or tracking before
451 | |                                 if pos == old_pos && assoc.stay_at_gaps() {
...   |
458 | |                             i
459 | |                         );
    | |_________________________- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_call
    = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: try not to call a closure in the expression where it is declared
   --> helix-core\src\transaction.rs:408:45
    |
408 |                           let Some(new_pos) = $map(**pos, *assoc) else { break; };
    |                                               ^^^^^^^^^^^^^^^^^^^
...
462 | /                         map!(
463 | |                             |pos, assoc: Assoc| (old_pos == pos).then(|| {
464 | |                                 // return position before inserted text
465 | |                                 new_pos + assoc.insert_offset(s)
466 | |                             }),
467 | |                             i
468 | |                         );
    | |_________________________- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_call
    = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: `helix-core` (lib) generated 12 warnings (run `cargo clippy --fix --lib -p helix-core` to apply 6 suggestions)
warning: use of `or_insert_with` to construct default value
   --> helix-lsp\src\file_event.rs:142:56
    |
142 |                     let entry = state.entry(client_id).or_insert_with(ClientState::default);
    |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
    = note: `#[warn(clippy::unwrap_or_default)]` on by default

warning: `helix-stdx` (lib) generated 2 warnings (2 duplicates)
warning: `helix-lsp` (lib) generated 1 warning (run `cargo clippy --fix --lib -p helix-lsp` to apply 1 suggestion)
warning: unneeded `return` statement
  --> helix-term\build.rs:70:17
   |
70 | /                 return Err(io::Error::new(
71 | |                     io::ErrorKind::Other,
72 | |                     format!("Failed to run registry query: {}", find_reg_key),
73 | |                 ))
   | |__________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
   = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
   |
70 ~                 Err(io::Error::new(
71 +                     io::ErrorKind::Other,
72 +                     format!("Failed to run registry query: {}", find_reg_key),
73 +                 ))
   |

warning: unneeded `return` statement
  --> helix-term\build.rs:77:21
   |
77 | /                     return Err(io::Error::new(
78 | |                         io::ErrorKind::Other,
79 | |                         "Can not find Windows SDK",
80 | |                     ));
   | |______________________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
   |
77 ~                     Err(io::Error::new(
78 +                         io::ErrorKind::Other,
79 +                         "Can not find Windows SDK",
80 ~                     ))
   |

warning: accessing first element with `debugger.stack_frames[&thread_id].get(0)`
  --> helix-view\src\handlers\dap.rs:40:17
   |
40 |     let frame = debugger.stack_frames[&thread_id].get(0).cloned();
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `debugger.stack_frames[&thread_id].first()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
   = note: `#[warn(clippy::get_first)]` on by default

warning: use of `or_insert_with` to construct default value
   --> helix-view\src\register.rs:126:59
    |
126 |                 let saved_values = self.inner.entry(name).or_insert_with(Vec::new);
    |                                                           ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
    = note: `#[warn(clippy::unwrap_or_default)]` on by default

warning: use of `or_insert_with` to construct default value
   --> helix-view\src\register.rs:143:40
    |
143 |                 self.inner.entry(name).or_insert_with(Vec::new).push(value);
    |                                        ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default

warning: manual backwards iteration
   --> helix-view\src\tree.rs:561:43
    |
561 |             let (key, _) = self.traverse().rev().next().unwrap();
    |                                           ^^^^^^^^^^^^^ help: use: `.next_back()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_next_back
    = note: `#[warn(clippy::manual_next_back)]` on by default

warning: `helix-view` (lib) generated 4 warnings (run `cargo clippy --fix --lib -p helix-view` to apply 4 suggestions)
warning: the borrowed expression implements the required traits
   --> helix-term\src\application.rs:727:69
    |
727 | ...                   Ok(path) => helix_stdx::path::normalize(&path),
    |                                                               ^^^^^ help: change this to: `path`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
    = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default

warning: `helix-term` (lib) generated 1 warning (run `cargo clippy --fix --lib -p helix-term` to apply 1 suggestion)

On MSRV Linux, no lints are emitted. But on latest stable (1.77.2) many are emitted, like the above.

Click me
warning: accessing first element with `pred.args.get(0)`
   --> helix-core/src/indent.rs:483:42
    |
483 |                 "not-kind-eq?" => match (pred.args.get(0), pred.args.get(1)) {
    |                                          ^^^^^^^^^^^^^^^^ help: try: `pred.args.first()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
    = note: `#[warn(clippy::get_first)]` on by default

warning: accessing first element with `pred.args.get(0)`
   --> helix-core/src/indent.rs:499:28
    |
499 |                     match (pred.args.get(0), pred.args.get(1)) {
    |                            ^^^^^^^^^^^^^^^^ help: try: `pred.args.first()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first

warning: accessing first element with `pred.args.get(0)`
   --> helix-core/src/indent.rs:521:56
    |
521 |                 "one-line?" | "not-one-line?" => match pred.args.get(0) {
    |                                                        ^^^^^^^^^^^^^^^^ help: try: `pred.args.first()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first

warning: use of `unwrap_or_else` to construct default value
   --> helix-core/src/indent.rs:766:54
    |
766 |             let mut cursor = ts_parser.cursors.pop().unwrap_or_else(QueryCursor::new);
    |                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
    = note: `#[warn(clippy::unwrap_or_default)]` on by default

warning: use of `format!` to build up a string from an iterator
   --> helix-core/src/syntax.rs:729:13
    |
729 | /             captures[1]
730 | |                 .split(',')
731 | |                 .map(|language| format!("\n{}\n", read_query(language, filename)))
732 | |                 .collect::<String>()
    | |____________________________________^
    |
help: call `fold` instead
   --> helix-core/src/syntax.rs:731:18
    |
731 |                 .map(|language| format!("\n{}\n", read_query(language, filename)))
    |                  ^^^
help: ... and use the `write!` macro here
   --> helix-core/src/syntax.rs:731:33
    |
731 |                 .map(|language| format!("\n{}\n", read_query(language, filename)))
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this can be written more efficiently by appending to a `String` directly
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#format_collect
    = note: `#[warn(clippy::format_collect)]` on by default

warning: use of `unwrap_or_else` to construct default value
    --> helix-core/src/syntax.rs:1247:54
     |
1247 |             let mut cursor = ts_parser.cursors.pop().unwrap_or_else(QueryCursor::new);
     |                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default

warning: use of `unwrap_or_else` to construct default value
    --> helix-core/src/syntax.rs:1421:47
     |
1421 |                     highlighter.cursors.pop().unwrap_or_else(QueryCursor::new)
     |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default

warning: try not to call a closure in the expression where it is declared
   --> helix-core/src/transaction.rs:408:45
    |
408 |                           let Some(new_pos) = $map(**pos, *assoc) else { break; };
    |                                               ^^^^^^^^^^^^^^^^^^^
...
416 | /                 map!(
417 | |                     |pos, _| (old_pos == pos).then_some(new_pos),
418 | |                     self.changes.len()
419 | |                 );
    | |_________________- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_call
    = note: `#[warn(clippy::redundant_closure_call)]` on by default
    = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: try not to call a closure in the expression where it is declared
   --> helix-core/src/transaction.rs:408:45
    |
408 |                           let Some(new_pos) = $map(**pos, *assoc) else { break; };
    |                                               ^^^^^^^^^^^^^^^^^^^
...
431 | /                     map!(
432 | |                         |pos, _| (old_end > pos).then_some(new_pos + (pos - old_pos)),
433 | |                         i
434 | |                     );
    | |_____________________- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_call
    = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: try not to call a closure in the expression where it is declared
   --> helix-core/src/transaction.rs:408:45
    |
408 |                         let Some(new_pos) = $map(**pos, *assoc) else { break; };
    |                                             ^^^^^^^^^^^^^^^^^^^
...
439 |                     map!(|pos, _| (old_end > pos).then_some(new_pos), i);
    |                     ---------------------------------------------------- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_call
    = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: try not to call a closure in the expression where it is declared
   --> helix-core/src/transaction.rs:408:45
    |
408 |                           let Some(new_pos) = $map(**pos, *assoc) else { break; };
    |                                               ^^^^^^^^^^^^^^^^^^^
...
448 | /                         map!(
449 | |                             |pos, assoc: Assoc| (old_end > pos).then(|| {
450 | |                                 // at point or tracking before
451 | |                                 if pos == old_pos && assoc.stay_at_gaps() {
...   |
458 | |                             i
459 | |                         );
    | |_________________________- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_call
    = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: try not to call a closure in the expression where it is declared
   --> helix-core/src/transaction.rs:408:45
    |
408 |                           let Some(new_pos) = $map(**pos, *assoc) else { break; };
    |                                               ^^^^^^^^^^^^^^^^^^^
...
462 | /                         map!(
463 | |                             |pos, assoc: Assoc| (old_pos == pos).then(|| {
464 | |                                 // return position before inserted text
465 | |                                 new_pos + assoc.insert_offset(s)
466 | |                             }),
467 | |                             i
468 | |                         );
    | |_________________________- in this macro invocation
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_call
    = note: this warning originates in the macro `map` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: `helix-core` (lib) generated 12 warnings (run `cargo clippy --fix --lib -p helix-core` to apply 6 suggestions)
warning: use of `or_insert_with` to construct default value
   --> helix-lsp/src/file_event.rs:142:56
    |
142 |                     let entry = state.entry(client_id).or_insert_with(ClientState::default);
    |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
    = note: `#[warn(clippy::unwrap_or_default)]` on by default

warning: `helix-lsp` (lib) generated 1 warning (run `cargo clippy --fix --lib -p helix-lsp` to apply 1 suggestion)
warning: accessing first element with `debugger.stack_frames[&thread_id].get(0)`
  --> helix-view/src/handlers/dap.rs:40:17
   |
40 |     let frame = debugger.stack_frames[&thread_id].get(0).cloned();
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `debugger.stack_frames[&thread_id].first()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
   = note: `#[warn(clippy::get_first)]` on by default

warning: use of `or_insert_with` to construct default value
   --> helix-view/src/register.rs:126:59
    |
126 |                 let saved_values = self.inner.entry(name).or_insert_with(Vec::new);
    |                                                           ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
    = note: `#[warn(clippy::unwrap_or_default)]` on by default

warning: use of `or_insert_with` to construct default value
   --> helix-view/src/register.rs:143:40
    |
143 |                 self.inner.entry(name).or_insert_with(Vec::new).push(value);
    |                                        ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default

warning: manual backwards iteration
   --> helix-view/src/tree.rs:561:43
    |
561 |             let (key, _) = self.traverse().rev().next().unwrap();
    |                                           ^^^^^^^^^^^^^ help: use: `.next_back()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_next_back
    = note: `#[warn(clippy::manual_next_back)]` on by default

warning: `helix-view` (lib) generated 4 warnings (run `cargo clippy --fix --lib -p helix-view` to apply 4 suggestions)
warning: the borrowed expression implements the required traits
   --> helix-term/src/application.rs:727:69
    |
727 | ...                   Ok(path) => helix_stdx::path::normalize(&path),
    |                                                               ^^^^^ help: change this to: `path`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
    = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default

warning: `helix-term` (lib) generated 1 warning (run `cargo clippy --fix --lib -p helix-term` to apply 1 suggestion)

To run clippy for other platforms there are two ways.

  1. Run other platforms in CI aka other runs-on platforms
  2. Do cross clippy lints i.e.
run: cargo clippy --workspace --all-targets --target x86_64-unknown-linux-gnu x86_64-pc-windows-gnu aarch64-apple-darwin -- -D warnings

But this can be difficult depending on the build configurations.

@RossSmyth RossSmyth added the C-enhancement Category: Improvements label Apr 12, 2024
@pascalkuthe pascalkuthe added A-packaging Area: Packaging and bundling O-windows Operating system: Windows and removed C-enhancement Category: Improvements labels Apr 13, 2024
@archseer
Copy link
Member

I think we just want the --all-targets flag.

@archseer
Copy link
Member

Hmm, which we do already use:

run: cargo clippy --workspace --all-targets -- -D warnings

@pascalkuthe
Copy link
Member

That's not what all targets does. All targets checks all build targets (test, bins, libs). You need a tool chain for a target to clippy check it so you would need to run cargo clippy for every platform in CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-packaging Area: Packaging and bundling O-windows Operating system: Windows
Projects
None yet
Development

No branches or pull requests

3 participants