Skip to content

Commit

Permalink
pedantic clippy fixes except must_use
Browse files Browse the repository at this point in the history
  • Loading branch information
Fogapod committed Feb 17, 2024
1 parent da38dba commit 831ad2a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/deserialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl TryFrom<PassDef> for Pass {
fn try_from(value: PassDef) -> Result<Self, Self::Error> {
let mut rules = value.rules.0;

for rule in rules.iter_mut() {
for rule in &mut rules {
rule.0 = runtime_format_single_value(&value.format, &rule.0)?;
}

Expand Down
2 changes: 1 addition & 1 deletion src/intensity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl Intensity {
for new_pass in passes {
let mut replaced = false;

for existing_pass in existing_passes.iter_mut() {
for existing_pass in &mut existing_passes {
if existing_pass.name == new_pass.name {
// FIXME: remove clone
*existing_pass = existing_pass.extend(new_pass.clone())?;
Expand Down
2 changes: 1 addition & 1 deletion src/pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl Pass {
for (new_regex, new_tag) in other.regexes.into_iter().zip(other.tags.into_iter()) {
let mut replaced = false;

for (existing_regex, existing_tag) in existing_rules.iter_mut() {
for (existing_regex, existing_tag) in &mut existing_rules {
if &new_regex == existing_regex {
// FIXME: remove clone
*existing_tag = new_tag.clone();
Expand Down
12 changes: 6 additions & 6 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ impl PartialEq for LiteralString {
fn case(char_count: usize, string: &str) -> (bool, bool, bool) {
let (lower, upper) = string.chars().fold((0, 0), |(lower, upper), c| {
(
lower + c.is_ascii_lowercase() as usize,
upper + c.is_ascii_uppercase() as usize,
lower + usize::from(c.is_ascii_lowercase()),
upper + usize::from(c.is_ascii_uppercase()),
)
});

Expand Down Expand Up @@ -90,13 +90,13 @@ impl LiteralString {

for (i, c_old) in source.chars().enumerate() {
if c_old.is_ascii_lowercase() {
body.get_mut(i..i + 1)
body.get_mut(i..=i)
.expect("strings have same len")
.make_ascii_lowercase()
.make_ascii_lowercase();
} else if c_old.is_ascii_uppercase() {
body.get_mut(i..i + 1)
body.get_mut(i..=i)
.expect("strings have same len")
.make_ascii_uppercase()
.make_ascii_uppercase();
}
}

Expand Down

0 comments on commit 831ad2a

Please sign in to comment.