Skip to content

Commit c5471e6

Browse files
committed
fix: clippy warnings (useless format!, map_or → is_some_and) + fmt
1 parent 9bd2adf commit c5471e6

2 files changed

Lines changed: 9 additions & 13 deletions

File tree

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/thetadatadx/build.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,8 @@ fn generate_endpoint_registry() -> Result<(), Box<dyn std::error::Error>> {
6161
.map(|f| ProtoField {
6262
name: f[3].to_string(),
6363
proto_type: f[2].to_string(),
64-
is_optional: f
65-
.get(1)
66-
.map_or(false, |m| m.as_str().starts_with("optional")),
67-
is_repeated: f
68-
.get(1)
69-
.map_or(false, |m| m.as_str().starts_with("repeated")),
64+
is_optional: f.get(1).is_some_and(|m| m.as_str().starts_with("optional")),
65+
is_repeated: f.get(1).is_some_and(|m| m.as_str().starts_with("repeated")),
7066
})
7167
.collect();
7268
query_messages.insert(msg_name, fields);
@@ -280,15 +276,15 @@ fn map_field(name: &str, proto_type: &str, is_repeated: bool) -> (String, String
280276
("string", "end_time") => ("Str".into(), "End time filter".into()),
281277
("string", "rate_type") => ("Str".into(), "Rate type".into()),
282278
("string", "version") => ("Str".into(), "Greeks model version".into()),
283-
("double", _) => ("Float".into(), format!("{}", humanize_name(name))),
279+
("double", _) => ("Float".into(), humanize_name(name).to_string()),
284280
("int32", "max_dte") => ("Int".into(), "Maximum days to expiration".into()),
285281
("int32", "strike_range") => ("Int".into(), "Strike range filter".into()),
286-
("int32", _) => ("Int".into(), format!("{}", humanize_name(name))),
282+
("int32", _) => ("Int".into(), humanize_name(name).to_string()),
287283
("bool", "exclusive") => ("Bool".into(), "Exclusive time boundary".into()),
288284
("bool", "use_market_value") => ("Bool".into(), "Use market value for Greeks".into()),
289285
("bool", "underlyer_use_nbbo") => ("Bool".into(), "Use NBBO for underlyer price".into()),
290-
("bool", _) => ("Bool".into(), format!("{}", humanize_name(name))),
291-
_ => ("Str".into(), format!("{}", humanize_name(name))),
286+
("bool", _) => ("Bool".into(), humanize_name(name).to_string()),
287+
_ => ("Str".into(), humanize_name(name).to_string()),
292288
}
293289
}
294290

0 commit comments

Comments
 (0)