Skip to content

Commit d2b7993

Browse files
committed
chore(clippy): fix clippy warnings
1 parent bb14084 commit d2b7993

2 files changed

Lines changed: 19 additions & 34 deletions

File tree

src/api/versions.rs

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,14 @@ impl ModrinthAPI {
4141

4242
let mut url = BASE_URL.join_all(vec!["project", project_id, "version"]);
4343

44-
match extra_options {
45-
Some(extra_options) => {
46-
url = BASE_URL.join_all(vec![
47-
"project", project_id, "version",
48-
// extra_options.number.unwrap_or(""),
49-
]);
50-
url = url.add_optional_query_json("loaders", extra_options.loaders)?;
51-
url = url.add_optional_query_json("game_versions", extra_options.game_versions)?;
52-
url = url.add_optional_query_json("featured", extra_options.featured)?;
53-
}
54-
None => {}
44+
if let Some(extra_options) = extra_options {
45+
url = BASE_URL.join_all(vec![
46+
"project", project_id, "version",
47+
// extra_options.number.unwrap_or(""),
48+
]);
49+
url = url.add_optional_query_json("loaders", extra_options.loaders)?;
50+
url = url.add_optional_query_json("game_versions", extra_options.game_versions)?;
51+
url = url.add_optional_query_json("featured", extra_options.featured)?;
5552
}
5653

5754
self.client.get(url).custom_send_json().await
@@ -110,19 +107,16 @@ impl ModrinthAPI {
110107

111108
let mut url = BASE_URL.join_all(vec!["project", project_id, "version"]);
112109

113-
match extra_options {
114-
Some(extra_options) => {
115-
url = BASE_URL.join_all(vec![
116-
"project",
117-
project_id,
118-
"version",
119-
extra_options.number.unwrap(),
120-
]);
121-
url = url.add_optional_query_json("loaders", extra_options.loaders)?;
122-
url = url.add_optional_query_json("game_versions", extra_options.game_versions)?;
123-
url = url.add_optional_query_json("featured", extra_options.featured)?;
124-
}
125-
None => {}
110+
if let Some(extra_options) = extra_options {
111+
url = BASE_URL.join_all(vec![
112+
"project",
113+
project_id,
114+
"version",
115+
extra_options.number.unwrap(),
116+
]);
117+
url = url.add_optional_query_json("loaders", extra_options.loaders)?;
118+
url = url.add_optional_query_json("game_versions", extra_options.game_versions)?;
119+
url = url.add_optional_query_json("featured", extra_options.featured)?;
126120
}
127121

128122
self.client.get(url).custom_send_json().await

src/structs/versions.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,13 @@ pub struct Version {
4040
/// If `Some(false)`, featured versions will be excluded. If `None`, both featured and
4141
/// non-featured versions are included. This is only applied if `number` is `None`.
4242
/// Example: `featured: Some(true)`
43-
#[derive(Debug)]
43+
#[derive(Debug, Default)]
4444
pub struct ProjectVersionsFilter<'a> {
4545
pub loaders: Option<&'a [&'a str]>,
4646
pub game_versions: Option<&'a [&'a str]>,
4747
pub featured: Option<bool>,
4848
}
4949

50-
impl<'a> Default for ProjectVersionsFilter<'a> {
51-
fn default() -> Self {
52-
ProjectVersionsFilter {
53-
loaders: None,
54-
game_versions: None,
55-
featured: None,
56-
}
57-
}
58-
}
5950

6051
/// Extra parameters for [ModrinthAPI::get_project_version] function
6152
///

0 commit comments

Comments
 (0)