Skip to content

feat(error): use thiserror for error generation #187

feat(error): use thiserror for error generation

feat(error): use thiserror for error generation #187

GitHub Actions / clippy succeeded Dec 19, 2023 in 0s

clippy

11 warnings

Details

Results

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

Versions

  • rustc 1.74.1 (a28077b28 2023-12-04)
  • cargo 1.74.1 (ecb9851af 2023-10-18)
  • clippy 0.1.74 (a28077b 2023-12-04)

Annotations

Check warning on line 214 in src/plugins/leetcode.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless conversion to the same type: `std::string::String`

warning: useless conversion to the same type: `std::string::String`
   --> src/plugins/leetcode.rs:214:18
    |
214 |             url: self.conf.sys.urls.graphql.into(),
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `self.conf.sys.urls.graphql`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

Check warning on line 196 in src/plugins/leetcode.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless use of `vec!`

warning: useless use of `vec!`
   --> src/plugins/leetcode.rs:183:13
    |
183 | /             vec![
184 | |                 "query getQuestionDetail($titleSlug: String!) {",
185 | |                 "  question(titleSlug: $titleSlug) {",
186 | |                 "    content",
...   |
195 | |                 "}",
196 | |             ]
    | |_____________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec
help: you can use an array directly
    |
183 ~             ["query getQuestionDetail($titleSlug: String!) {",
184 +                 "  question(titleSlug: $titleSlug) {",
185 +                 "    content",
186 +                 "    stats",
187 +                 "    codeDefinition",
188 +                 "    sampleTestCase",
189 +                 "    exampleTestcases",
190 +                 "    enableRunCode",
191 +                 "    metaData",
192 +                 "    translatedContent",
193 +                 "  }",
194 +                 "}"]
    |

Check warning on line 159 in src/plugins/leetcode.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless use of `vec!`

warning: useless use of `vec!`
   --> src/plugins/leetcode.rs:151:13
    |
151 | /             vec![
152 | |                 "query daily {",
153 | |                 "  activeDailyCodingChallengeQuestion {",
154 | |                 "    question {",
...   |
158 | |                 "}",
159 | |             ]
    | |_____________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec
help: you can use an array directly
    |
151 ~             ["query daily {",
152 +                 "  activeDailyCodingChallengeQuestion {",
153 +                 "    question {",
154 +                 "      questionFrontendId",
155 +                 "    }",
156 +                 "  }",
157 +                 "}"]
    |

Check warning on line 97 in src/plugins/leetcode.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless use of `vec!`

warning: useless use of `vec!`
  --> src/plugins/leetcode.rs:89:13
   |
89 | /             vec![
90 | |                 "query getTopicTag($slug: String!) {",
91 | |                 "  topicTag(slug: $slug) {",
92 | |                 "    questions {",
...  |
96 | |                 "}",
97 | |             ]
   | |_____________^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec
help: you can use an array directly
   |
89 ~             ["query getTopicTag($slug: String!) {",
90 +                 "  topicTag(slug: $slug) {",
91 +                 "    questions {",
92 +                 "      questionId",
93 +                 "    }",
94 +                 "  }",
95 +                 "}"]
   |

Check warning on line 68 in src/config/storage.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
  --> src/config/storage.rs:68:42
   |
68 |         let p = PathBuf::from(root).join(&self.scripts.ok_or(Error::NoneError)?);
   |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `self.scripts.ok_or(Error::NoneError)?`
   |
   = 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

Check warning on line 84 in src/cmds/stat.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless use of `vec!`

warning: useless use of `vec!`
  --> src/cmds/stat.rs:84:23
   |
84 |         for (i, l) in vec![(easy, easy_ac), (medium, medium_ac), (hard, hard_ac)]
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `[(easy, easy_ac), (medium, medium_ac), (hard, hard_ac)]`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec
   = note: `#[warn(clippy::useless_vec)]` on by default

Check warning on line 193 in src/cmds/pick.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

length comparison to zero

warning: length comparison to zero
   --> src/cmds/pick.rs:193:13
    |
193 |     assert!(problems.len() > 0);
    |             ^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!problems.is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
    = note: `#[warn(clippy::len_zero)]` on by default

Check warning on line 146 in src/cmds/pick.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this pattern reimplements `Option::unwrap_or`

warning: this pattern reimplements `Option::unwrap_or`
   --> src/cmds/pick.rs:143:39
    |
143 |                       Some(quesname) => match closest_named_problem(&problems, quesname) {
    |  _______________________________________^
144 | |                         Some(p) => p,
145 | |                         None => 1,
146 | |                     },
    | |_____________________^ help: replace with: `closest_named_problem(&problems, quesname).unwrap_or(1)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or
    = note: `#[warn(clippy::manual_unwrap_or)]` on by default

Check warning on line 142 in src/cmds/pick.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unnecessary map of the identity function

warning: unnecessary map of the identity function
   --> src/cmds/pick.rs:142:50
    |
142 |                 match m.get_one::<String>("name").map(|name| name) {
    |                                                  ^^^^^^^^^^^^^^^^^ help: remove the call to `map`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_identity
    = note: `#[warn(clippy::map_identity)]` on by default

Check warning on line 187 in src/cmds/list.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

useless conversion to the same type: `std::iter::Copied<clap::parser::ValuesRef<'_, i32>>`

warning: useless conversion to the same type: `std::iter::Copied<clap::parser::ValuesRef<'_, i32>>`
   --> src/cmds/list.rs:183:39
    |
183 |               let num_range: Vec<i32> = m
    |  _______________________________________^
184 | |                 .get_many::<i32>("range")
185 | |                 .ok_or(Error::NoneError)?
186 | |                 .copied()
187 | |                 .into_iter()
    | |____________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
    = note: `#[warn(clippy::useless_conversion)]` on by default
help: consider removing `.into_iter()`
    |
183 ~             let num_range: Vec<i32> = m
184 +                 .get_many::<i32>("range")
185 +                 .ok_or(Error::NoneError)?
186 +                 .copied()
    |

Check warning on line 35 in src/cache/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `impl` can be derived

warning: this `impl` can be derived
  --> src/cache/mod.rs:31:1
   |
31 | / impl Default for Run {
32 | |     fn default() -> Self {
33 | |         Run::Submit
34 | |     }
35 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
   = note: `#[warn(clippy::derivable_impls)]` on by default
   = help: remove the manual implementation...
help: ...and instead derive it...
   |
26 + #[derive(Default)]
27 | pub enum Run {
   |
help: ...and mark the default variant
   |
28 ~     #[default]
29 ~     Submit,
   |