Skip to content

Merge pull request #99 from andrewbaxter/remove-dump-test2 #177

Merge pull request #99 from andrewbaxter/remove-dump-test2

Merge pull request #99 from andrewbaxter/remove-dump-test2 #177

GitHub Actions / clippy succeeded Dec 15, 2024 in 4s

clippy

300 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 300
Note 0
Help 0

Versions

  • rustc 1.83.0 (90b35a623 2024-11-26)
  • cargo 1.83.0 (5ffbef321 2024-10-29)
  • clippy 0.1.83 (90b35a6 2024-11-26)

Annotations

Check warning on line 341 in crates/genemichaels/src/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

using `clone` on type `FormatConfig` which implements the `Copy` trait

warning: using `clone` on type `FormatConfig` which implements the `Copy` trait
   --> crates/genemichaels/src/main.rs:341:22
    |
341 |         let config = self.config.clone();
    |                      ^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.config`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
    = note: `#[warn(clippy::clone_on_copy)]` on by default

Check warning on line 335 in crates/genemichaels/src/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> crates/genemichaels/src/main.rs:324:9
    |
324 | /         return FormatPool {
325 | |             log: log.clone(),
326 | |             config: config,
327 | |             pool: {
...   |
334 | |             errors: Arc::new(Mutex::new(vec![])),
335 | |         };
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
324 ~         FormatPool {
325 +             log: log.clone(),
326 +             config: config,
327 +             pool: {
328 +                 let mut p = threadpool::Builder::new();
329 +                 if let Some(t) = thread_count {
330 +                     p = p.num_threads(t);
331 +                 }
332 +                 p.build()
333 +             },
334 +             errors: Arc::new(Mutex::new(vec![])),
335 ~         }
    |

Check warning on line 181 in crates/genemichaels/src/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> crates/genemichaels/src/main.rs:181:38
    |
181 |             let config = load_config(&log, &[args.config, Some(PathBuf::from(CONFIG_JSON))])?;
    |                                      ^^^^ help: change this to: `log`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 166 in crates/genemichaels/src/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> crates/genemichaels/src/main.rs:166:38
    |
166 |             let config = load_config(&log, &[args.config, Some(PathBuf::from(CONFIG_JSON))])?;
    |                                      ^^^^ help: change this to: `log`
    |
    = 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

Check warning on line 102 in crates/genemichaels/src/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> crates/genemichaels/src/main.rs:102:21
    |
102 |                     return true;
    |                     ^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
102 -                     return true;
102 +                     true
    |

Check warning on line 107 in crates/genemichaels/src/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

question mark operator is useless here

warning: question mark operator is useless here
   --> crates/genemichaels/src/main.rs:93:12
    |
93  |       return Ok(
    |  ____________^
94  | |         serde_json::from_str(
95  | |             &String::from_utf8(read(path).stack_context(log, "Failed to read config file")?)
96  | |                 .stack_context(log, "Failed to decode file as utf8")?
...   |
106 | |         ).stack_context(log, "Failed to parse file as json")?,
107 | |     );
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark
    = note: `#[warn(clippy::needless_question_mark)]` on by default
help: try removing question mark and `Ok()`
    |
93  ~     return serde_json::from_str(
94  +             &String::from_utf8(read(path).stack_context(log, "Failed to read config file")?)
95  +                 .stack_context(log, "Failed to decode file as utf8")?
96  +                 .lines()
97  +                 .filter(|l| {
98  +                     if l.trim_start().starts_with("//") {
99  +                         return false;
100 +                     }
101 +                     return true;
102 +                 })
103 +                 .collect::<Vec<&str>>()
104 +                 .join("\n"),
105 ~         ).stack_context(log, "Failed to parse file as json");
    |

Check warning on line 87 in crates/genemichaels/src/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> crates/genemichaels/src/main.rs:87:9
   |
87 |         return Some(p);
   |         ^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
   |
87 -         return Some(p);
87 +         Some(p)
   |

Check warning on line 107 in crates/genemichaels/src/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> crates/genemichaels/src/main.rs:93:5
    |
93  | /     return Ok(
94  | |         serde_json::from_str(
95  | |             &String::from_utf8(read(path).stack_context(log, "Failed to read config file")?)
96  | |                 .stack_context(log, "Failed to decode file as utf8")?
...   |
106 | |         ).stack_context(log, "Failed to parse file as json")?,
107 | |     );
    | |_____^
    |
    = 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`
    |
93  ~     Ok(
94  +         serde_json::from_str(
95  +             &String::from_utf8(read(path).stack_context(log, "Failed to read config file")?)
96  +                 .stack_context(log, "Failed to decode file as utf8")?
97  +                 .lines()
98  +                 .filter(|l| {
99  +                     if l.trim_start().starts_with("//") {
100 +                         return false;
101 +                     }
102 +                     return true;
103 +                 })
104 +                 .collect::<Vec<&str>>()
105 +                 .join("\n"),
106 +         ).stack_context(log, "Failed to parse file as json")?,
107 ~     )
    |

Check warning on line 326 in crates/genemichaels/src/main.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

redundant field names in struct initialization

warning: redundant field names in struct initialization
   --> crates/genemichaels/src/main.rs:326:13
    |
326 |             config: config,
    |             ^^^^^^^^^^^^^^ help: replace it with: `config`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
    = note: `#[warn(clippy::redundant_field_names)]` on by default

Check warning on line 792 in crates/genemichaels-lib/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> crates/genemichaels-lib/src/lib.rs:792:86
    |
792 | ...                   let prefix = format!("{}//{} ", " ".repeat(b.get(&config)), match comment.mode {
    |                                                                        ^^^^^^^ help: change this to: `config`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 774 in crates/genemichaels-lib/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> crates/genemichaels-lib/src/lib.rs:774:53
    |
774 | ...                   push!(&" ".repeat(b.get(&config)));
    |                                               ^^^^^^^ help: change this to: `config`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 770 in crates/genemichaels-lib/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> crates/genemichaels-lib/src/lib.rs:770:40
    |
770 | ...                   b.activate(&config);
    |                                  ^^^^^^^ help: change this to: `config`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 555 in crates/genemichaels-lib/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

using `clone` on type `FormatConfig` which implements the `Copy` trait

warning: using `clone` on type `FormatConfig` which implements the `Copy` trait
   --> crates/genemichaels-lib/src/lib.rs:555:17
    |
555 |         config: config.clone(),
    |                 ^^^^^^^^^^^^^^ help: try dereferencing it: `*config`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
    = note: `#[warn(clippy::clone_on_copy)]` on by default

Check warning on line 541 in crates/genemichaels-lib/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> crates/genemichaels-lib/src/lib.rs:541:9
    |
541 |         return Ok(out);
    |         ^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
541 -         return Ok(out);
541 +         Ok(out)
    |

Check warning on line 539 in crates/genemichaels-lib/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> crates/genemichaels-lib/src/lib.rs:535:9
    |
535 | /         return Ok(FormatRes {
536 | |             rendered: format!("{}{}", shebang, out.rendered),
537 | |             lost_comments: out.lost_comments,
538 | |             warnings: out.warnings,
539 | |         });
    | |__________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
535 ~         Ok(FormatRes {
536 +             rendered: format!("{}{}", shebang, out.rendered),
537 +             lost_comments: out.lost_comments,
538 +             warnings: out.warnings,
539 ~         })
    |

Check warning on line 184 in crates/genemichaels-lib/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

accessing first element with `new_segs.get(0)`

warning: accessing first element with `new_segs.get(0)`
   --> crates/genemichaels-lib/src/lib.rs:184:21
    |
184 |         let seg_i = new_segs.get(0).unwrap();
    |                     ^^^^^^^^^^^^^^^ help: try: `new_segs.first()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first

Check warning on line 708 in crates/genemichaels-lib/src/sg_type.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> crates/genemichaels-lib/src/sg_type.rs:708:25
    |
708 |                         return build_self(out, base_indent);
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
708 -                         return build_self(out, base_indent);
708 +                         build_self(out, base_indent)
    |

Check warning on line 706 in crates/genemichaels-lib/src/sg_type.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> crates/genemichaels-lib/src/sg_type.rs:706:25
    |
706 |                         return new_sg_binary(out, base_indent, build_self, colon.span.start(), ":", x.ty.as_ref());
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
    |
706 -                         return new_sg_binary(out, base_indent, build_self, colon.span.start(), ":", x.ty.as_ref());
706 +                         new_sg_binary(out, base_indent, build_self, colon.span.start(), ":", x.ty.as_ref())
    |

Check warning on line 374 in crates/genemichaels-lib/src/sg_type.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits
   --> crates/genemichaels-lib/src/sg_type.rs:374:37
    |
374 |                         sg.seg(out, &c.ident.to_string());
    |                                     ^^^^^^^^^^^^^^^^^^^^ help: change this to: `c.ident.to_string()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args

Check warning on line 127 in crates/genemichaels-lib/src/sg_type.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits
   --> crates/genemichaels-lib/src/sg_type.rs:127:23
    |
127 |         node.seg(out, &seg.value().ident.to_string());
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `seg.value().ident.to_string()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args

Check warning on line 79 in crates/aargvark/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> crates/aargvark/src/lib.rs:79:31
   |
79 |             VarkRet::Ok(v) => return v,
   |                               ^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
   |
79 |             VarkRet::Ok(v) => v,
   |                               ~

Check warning on line 1174 in crates/genemichaels-lib/src/sg_statement.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits
    --> crates/genemichaels-lib/src/sg_statement.rs:1174:29
     |
1174 |                 sg.seg(out, &x.ident.to_string());
     |                             ^^^^^^^^^^^^^^^^^^^^ help: change this to: `x.ident.to_string()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args

Check warning on line 1169 in crates/genemichaels-lib/src/sg_statement.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits
    --> crates/genemichaels-lib/src/sg_statement.rs:1169:29
     |
1169 |                 sg.seg(out, &format!("{}::", x.ident));
     |                             ^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `format!("{}::", x.ident)`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args

Check warning on line 66 in crates/aargvark/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> crates/aargvark/src/lib.rs:66:13
   |
66 |             return Ok(VarkRet::Ok(v));
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
   |
66 -             return Ok(VarkRet::Ok(v));
66 +             Ok(VarkRet::Ok(v))
   |

Check warning on line 56 in crates/aargvark/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
  --> crates/aargvark/src/lib.rs:51:13
   |
51 | /             return Ok(VarkRet::Help(VarkRetHelp {
52 | |                 command: state.command,
53 | |                 args: state.args,
54 | |                 consumed_args: state.i,
55 | |                 builder: builder,
56 | |             }));
   | |_______________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
help: remove `return`
   |
51 ~             Ok(VarkRet::Help(VarkRetHelp {
52 +                 command: state.command,
53 +                 args: state.args,
54 +                 consumed_args: state.i,
55 +                 builder: builder,
56 ~             }))
   |