Skip to content

Commit 747f41a

Browse files
authored
Fix clippy warnings following GH Actions Rust version bump (#288)
1 parent 4253c37 commit 747f41a

File tree

15 files changed

+47
-59
lines changed

15 files changed

+47
-59
lines changed

partiql-ast/partiql-ast-macros/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ fn should_skip_variant(variant: &syn::Variant) -> bool {
5050
fn impl_visit(ast: &syn::DeriveInput) -> proc_macro2::TokenStream {
5151
let visit_fn_name = &ast.ident.to_string().to_snake_case();
5252
let enter_fn_name = Ident::new(
53-
&format!("enter_{}", visit_fn_name),
53+
&format!("enter_{visit_fn_name}"),
5454
proc_macro2::Span::call_site(),
5555
);
5656
let exit_fn_name = Ident::new(
57-
&format!("exit_{}", visit_fn_name),
57+
&format!("exit_{visit_fn_name}"),
5858
proc_macro2::Span::call_site(),
5959
);
6060

partiql-ast/src/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub enum Item {
4343
impl fmt::Display for Item {
4444
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4545
// Use Debug formatting for now
46-
write!(f, "{:?}", self)
46+
write!(f, "{self:?}")
4747
}
4848
}
4949

partiql-conformance-test-generator/src/generator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ impl Generator {
290290
.join("___")
291291
+ ".env.ion";
292292

293-
let data_file = format!("{}/{}", TEST_DATA_DIR, env_file);
293+
let data_file = format!("{TEST_DATA_DIR}/{env_file}");
294294
scope.raw(
295295
quote! {
296296
const ENV_ION_TEXT : &'static str = include_str!(#data_file);
@@ -446,7 +446,7 @@ impl Generator {
446446
Node::Value(TestValueNode { value: expected }),
447447
);
448448

449-
let data_file = format!("{}/{}", TEST_DATA_DIR, expected_file);
449+
let data_file = format!("{TEST_DATA_DIR}/{expected_file}");
450450
quote! {include_str!(#data_file)}
451451
} else {
452452
quote! {#expected}

partiql-conformance-tests/tests/mod.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ pub(crate) fn fail_syntax(statement: &str) {
5050
let res = parse(statement);
5151
assert!(
5252
res.is_err(),
53-
"For `{}`, expected `Err(_)`, but was `{:#?}`",
54-
statement,
55-
res
53+
"For `{statement}`, expected `Err(_)`, but was `{res:#?}`"
5654
);
5755
}
5856

@@ -63,9 +61,7 @@ pub(crate) fn pass_syntax(statement: &str) -> Parsed {
6361
let res = parse(statement);
6462
assert!(
6563
res.is_ok(),
66-
"For `{}`, expected `Ok(_)`, but was `{:#?}`",
67-
statement,
68-
res
64+
"For `{statement}`, expected `Ok(_)`, but was `{res:#?}`"
6965
);
7066
res.unwrap()
7167
}
@@ -86,9 +82,7 @@ pub(crate) fn pass_semantics(statement: &str) {
8682
let lowered: Result<_, ()> = Ok(lower(&parsed));
8783
assert!(
8884
lowered.is_ok(),
89-
"For `{}`, expected `Ok(_)`, but was `{:#?}`",
90-
statement,
91-
lowered
85+
"For `{statement}`, expected `Ok(_)`, but was `{lowered:#?}`"
9286
);
9387
}
9488

partiql-conformance-tests/tests/test_value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn parse_test_value(reader: &mut Reader, typ: IonType) -> Value {
6060
// TODO ion Decimal doesn't give a lot of functionality to get at the data currently
6161
// TODO and it's not clear whether we'll continue with rust decimal or switch to big decimal
6262
let ion_dec = reader.read_decimal().unwrap();
63-
let ion_dec_str = format!("{}", ion_dec).replace('d', "e");
63+
let ion_dec_str = format!("{ion_dec}").replace('d', "e");
6464
Value::Decimal(rust_decimal::Decimal::from_scientific(&ion_dec_str).unwrap())
6565
}
6666
IonType::Timestamp => todo!("timestamp"),

partiql-eval/src/env.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub mod basic {
4343
self.sensitive.insert(name.to_string(), idx);
4444
e.insert(idx);
4545
} else {
46-
panic!("Cannot insert duplicate binding of name {}", name)
46+
panic!("Cannot insert duplicate binding of name {name}")
4747
}
4848
}
4949
}

partiql-eval/src/eval.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ impl EvalPlan {
9191
}
9292
Err(e) => Err(EvalErr {
9393
errors: vec![EvaluationError::InvalidEvaluationPlan(format!(
94-
"Malformed evaluation plan detected: {:?}",
95-
e
94+
"Malformed evaluation plan detected: {e:?}"
9695
))],
9796
}),
9897
}
@@ -1050,14 +1049,14 @@ impl EvalExpr for EvalBinOpExpr {
10501049
let lhs = if let Value::String(s) = lhs {
10511050
*s
10521051
} else {
1053-
format!("{:?}", lhs)
1052+
format!("{lhs:?}")
10541053
};
10551054
let rhs = if let Value::String(s) = rhs {
10561055
*s
10571056
} else {
1058-
format!("{:?}", rhs)
1057+
format!("{rhs:?}")
10591058
};
1060-
Value::String(Box::new(format!("{}{}", lhs, rhs)))
1059+
Value::String(Box::new(format!("{lhs}{rhs}")))
10611060
}
10621061
}
10631062
}

partiql-eval/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,8 +1276,7 @@ mod tests {
12761276
"data".into(),
12771277
))),
12781278
vec![PathComponent::Key(BindingsName::CaseInsensitive(format!(
1279-
"arg{}",
1280-
i
1279+
"arg{i}"
12811280
)))],
12821281
)
12831282
}
@@ -1300,7 +1299,7 @@ mod tests {
13001299
elements
13011300
.into_iter()
13021301
.enumerate()
1303-
.for_each(|(i, e)| data.insert(&format!("arg{}", i), e));
1302+
.for_each(|(i, e)| data.insert(&format!("arg{i}"), e));
13041303
bindings.insert("data", partiql_list![data].into());
13051304

13061305
let result = evaluate(plan, bindings).coerce_to_bag();

partiql-logical-planner/src/lower.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ impl<'ast> Visitor<'ast> for AstToLogical {
648648
// TODO intern strings
649649
let as_key = match as_key {
650650
name_resolver::Symbol::Known(sym) => sym.value.clone(),
651-
name_resolver::Symbol::Unknown(id) => format!("_{}", id),
651+
name_resolver::Symbol::Unknown(id) => format!("_{id}"),
652652
};
653653
self.push_value(as_key.into());
654654
}

partiql-parser/src/lexer.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -737,16 +737,16 @@ impl<'input> fmt::Display for Token<'input> {
737737
Token::Caret => write!(f, "^"),
738738
Token::Period => write!(f, "."),
739739
Token::DblPipe => write!(f, "||"),
740-
Token::UnquotedIdent(id) => write!(f, "<{}:UNQUOTED_IDENT>", id),
741-
Token::QuotedIdent(id) => write!(f, "<{}:QUOTED_IDENT>", id),
742-
Token::UnquotedAtIdentifier(id) => write!(f, "<{}:UNQUOTED_ATIDENT>", id),
743-
Token::QuotedAtIdentifier(id) => write!(f, "<{}:QUOTED_ATIDENT>", id),
744-
Token::Int(txt) => write!(f, "<{}:INT>", txt),
745-
Token::ExpReal(txt) => write!(f, "<{}:REAL>", txt),
746-
Token::Real(txt) => write!(f, "<{}:REAL>", txt),
747-
Token::String(txt) => write!(f, "<{}:STRING>", txt),
740+
Token::UnquotedIdent(id) => write!(f, "<{id}:UNQUOTED_IDENT>"),
741+
Token::QuotedIdent(id) => write!(f, "<{id}:QUOTED_IDENT>"),
742+
Token::UnquotedAtIdentifier(id) => write!(f, "<{id}:UNQUOTED_ATIDENT>"),
743+
Token::QuotedAtIdentifier(id) => write!(f, "<{id}:QUOTED_ATIDENT>"),
744+
Token::Int(txt) => write!(f, "<{txt}:INT>"),
745+
Token::ExpReal(txt) => write!(f, "<{txt}:REAL>"),
746+
Token::Real(txt) => write!(f, "<{txt}:REAL>"),
747+
Token::String(txt) => write!(f, "<{txt}:STRING>"),
748748
Token::EmbeddedIonQuote => write!(f, "<ION>"),
749-
Token::Ion(txt) => write!(f, "<{}:ION>", txt),
749+
Token::Ion(txt) => write!(f, "<{txt}:ION>"),
750750

751751
Token::All
752752
| Token::Asc
@@ -811,7 +811,7 @@ impl<'input> fmt::Display for Token<'input> {
811811
| Token::With
812812
| Token::Without
813813
| Token::Zone => {
814-
write!(f, "{}", format!("{:?}", self).to_uppercase())
814+
write!(f, "{}", format!("{self:?}").to_uppercase())
815815
}
816816
}
817817
}

0 commit comments

Comments
 (0)