Skip to content

Commit

Permalink
janitor: Fix clippy "manual char comparison can be written more succi…
Browse files Browse the repository at this point in the history
…nctly"
  • Loading branch information
hunger committed Jun 24, 2024
1 parent 0639b9a commit 1c8b373
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/compiler/passes/resolving.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ impl Expression {
let mut pos_max = 0;
let mut pos = 0;
let mut has_n = false;
while let Some(mut p) = string[pos..].find(|x| x == '{' || x == '}') {
while let Some(mut p) = string[pos..].find(['{', '}']) {
if string.len() - pos < p + 1 {
ctx.diag.push_error(
"Unescaped trailing '{' in format string. Escape '{' with '{{'".into(),
Expand Down
2 changes: 1 addition & 1 deletion internal/core/translations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ mod formatter {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
let mut arg_idx = 0;
let mut pos = 0;
while let Some(mut p) = self.format_str[pos..].find(|x| x == '{' || x == '}') {
while let Some(mut p) = self.format_str[pos..].find(['{', '}']) {
if self.format_str.len() - pos < p + 1 {
break;
}
Expand Down

0 comments on commit 1c8b373

Please sign in to comment.