Skip to content

Commit

Permalink
Fix new Clippy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
scouten-adobe committed Feb 19, 2025
1 parent 7ef6a98 commit aeadefa
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
5 changes: 1 addition & 4 deletions sdk/src/assertion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,7 @@ pub fn get_thumbnail_instance(label: &str) -> Option<usize> {
let components: Vec<&str> = label.split("__").collect();
if components.len() == 2 {
let subparts: Vec<&str> = components[1].split('.').collect();
match subparts[0].parse::<usize>() {
Ok(i) => Some(i),
Err(_e) => None,
}
subparts[0].parse::<usize>().ok()

Check warning on line 89 in sdk/src/assertion.rs

View check run for this annotation

Codecov / codecov/patch

sdk/src/assertion.rs#L89

Added line #L89 was not covered by tests
} else {
Some(0)
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/manifest_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ impl std::fmt::Display for ManifestStore {
let idx3 = json[index..].find('[').unwrap_or_default();

let bytes: Vec<u8> =
serde_json::from_slice(json[index + idx3..index + idx2 + 1].as_bytes())
serde_json::from_slice(&json.as_bytes()[index + idx3..index + idx2 + 1])

Check warning on line 575 in sdk/src/manifest_store.rs

View check run for this annotation

Codecov / codecov/patch

sdk/src/manifest_store.rs#L575

Added line #L575 was not covered by tests
.unwrap_or_default();

json = format!(
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/manifest_store_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ fn b64_tag(mut json: String, tag: &str) -> String {
if let Some(idx2) = json[index..].find(']') {
let idx3 = json[index..].find('[').unwrap_or_default(); // ok since we just found it
let bytes: Vec<u8> =
serde_json::from_slice(json[index + idx3..index + idx2 + 1].as_bytes())
serde_json::from_slice(&json.as_bytes()[index + idx3..index + idx2 + 1])

Check warning on line 422 in sdk/src/manifest_store_report.rs

View check run for this annotation

Codecov / codecov/patch

sdk/src/manifest_store_report.rs#L422

Added line #L422 was not covered by tests
.unwrap_or_default();
json = format!(
"{}\"{}\": \"{}\"{}",
Expand Down
11 changes: 3 additions & 8 deletions sdk/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,14 +293,9 @@ pub(crate) fn get_settings() -> Option<Settings> {
let source = c.clone(); // clone required since deserialize consumes object
let cloned_config = Config::builder().add_source(source).build();

if let Ok(cloned_config) = cloned_config {
match cloned_config.try_deserialize::<Settings>() {
Ok(s) => Some(s),
Err(_) => None,
}
} else {
None
}
cloned_config
.ok()
.and_then(|s| s.try_deserialize::<Settings>().ok())

Check warning on line 298 in sdk/src/settings.rs

View check run for this annotation

Codecov / codecov/patch

sdk/src/settings.rs#L296-L298

Added lines #L296 - L298 were not covered by tests
}
Err(_) => None,
}
Expand Down

0 comments on commit aeadefa

Please sign in to comment.