Skip to content

Commit 86a6143

Browse files
authored
Fix clippy lints for Rust 1.97 (#2402)
1 parent aeb616f commit 86a6143

7 files changed

Lines changed: 14 additions & 14 deletions

File tree

examples/cli.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ $ cargo run --example cli - [--dialectname]
7171
.expect("failed to read from stdin");
7272
String::from_utf8(buf).expect("stdin content wasn't valid utf8")
7373
} else {
74-
println!("Parsing from file '{}' using {:?}", &filename, dialect);
74+
println!("Parsing from file '{}' using {:?}", filename, dialect);
7575
fs::read_to_string(&filename)
76-
.unwrap_or_else(|_| panic!("Unable to read the file {}", &filename))
76+
.unwrap_or_else(|_| panic!("Unable to read the file {}", filename))
7777
};
7878
let without_bom = if contents.chars().next().unwrap() as u64 != 0xfeff {
7979
contents.as_str()

src/ast/ddl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4780,7 +4780,7 @@ impl fmt::Display for AlterTable {
47804780
if self.only {
47814781
write!(f, "ONLY ")?;
47824782
}
4783-
write!(f, "{} ", &self.name)?;
4783+
write!(f, "{} ", self.name)?;
47844784
if let Some(cluster) = &self.on_cluster {
47854785
write!(f, "ON CLUSTER {cluster} ")?;
47864786
}

src/ast/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11842,7 +11842,7 @@ impl fmt::Display for AlterUser {
1184211842
let has_props = !self.set_props.options.is_empty();
1184311843
if has_props {
1184411844
write!(f, " SET")?;
11845-
write!(f, " {}", &self.set_props)?;
11845+
write!(f, " {}", self.set_props)?;
1184611846
}
1184711847
if !self.unset_props.is_empty() {
1184811848
write!(f, " UNSET {}", display_comma_separated(&self.unset_props))?;

src/ast/query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3545,7 +3545,7 @@ pub struct LockClause {
35453545

35463546
impl fmt::Display for LockClause {
35473547
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
3548-
write!(f, "FOR {}", &self.lock_type)?;
3548+
write!(f, "FOR {}", self.lock_type)?;
35493549
if let Some(ref of) = self.of {
35503550
write!(f, " OF {of}")?;
35513551
}

src/parser/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4845,7 +4845,7 @@ impl<'a> Parser<'a> {
48454845
if self.parse_keyword(expected) {
48464846
Ok(self.get_current_token().clone())
48474847
} else {
4848-
self.expected_ref(format!("{:?}", &expected).as_str(), self.peek_token_ref())
4848+
self.expected_ref(format!("{:?}", expected).as_str(), self.peek_token_ref())
48494849
}
48504850
}
48514851

@@ -4858,7 +4858,7 @@ impl<'a> Parser<'a> {
48584858
if self.parse_keyword(expected) {
48594859
Ok(())
48604860
} else {
4861-
self.expected_ref(format!("{:?}", &expected).as_str(), self.peek_token_ref())
4861+
self.expected_ref(format!("{:?}", expected).as_str(), self.peek_token_ref())
48624862
}
48634863
}
48644864

@@ -13724,7 +13724,7 @@ impl<'a> Parser<'a> {
1372413724
}
1372513725
Token::EOF => break,
1372613726
token => {
13727-
return Err(ParserError::ParserError(format!(
13727+
Err(ParserError::ParserError(format!(
1372813728
"Unexpected token in identifier: {token}"
1372913729
)))?;
1373013730
}
@@ -17012,7 +17012,7 @@ impl<'a> Parser<'a> {
1701217012
where_clause = Some(self.parse_expr()?);
1701317013
} else {
1701417014
let tok = self.peek_token_ref();
17015-
return parser_err!(
17015+
parser_err!(
1701617016
format!(
1701717017
"Expected one of DIMENSIONS, METRICS, FACTS or WHERE, got {}",
1701817018
tok.token

tests/sqlparser_common.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,7 @@ fn parse_json_ops_without_colon() {
17311731
];
17321732

17331733
for (str_op, op, dialects) in binary_ops {
1734-
let select = dialects.verified_only_select(&format!("SELECT a {} b", &str_op));
1734+
let select = dialects.verified_only_select(&format!("SELECT a {} b", str_op));
17351735
assert_eq!(
17361736
SelectItem::UnnamedExpr(Expr::BinaryOp {
17371737
left: Box::new(Expr::Identifier(Ident::new("a"))),
@@ -2441,7 +2441,7 @@ fn parse_bitwise_ops() {
24412441
];
24422442

24432443
for (str_op, op, dialects) in bitwise_ops {
2444-
let select = dialects.verified_only_select(&format!("SELECT a {} b", &str_op));
2444+
let select = dialects.verified_only_select(&format!("SELECT a {} b", str_op));
24452445
assert_eq!(
24462446
SelectItem::UnnamedExpr(Expr::BinaryOp {
24472447
left: Box::new(Expr::Identifier(Ident::new("a"))),
@@ -19100,7 +19100,7 @@ fn parse_generic_unary_ops() {
1910019100
("+", UnaryOperator::Plus),
1910119101
];
1910219102
for (str_op, op) in unary_ops {
19103-
let select = verified_only_select(&format!("SELECT {}expr", &str_op));
19103+
let select = verified_only_select(&format!("SELECT {}expr", str_op));
1910419104
assert_eq!(
1910519105
UnnamedExpr(UnaryOp {
1910619106
op: *op,

tests/sqlparser_postgres.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2574,7 +2574,7 @@ fn parse_pg_unary_ops() {
25742574
("@", UnaryOperator::PGAbs),
25752575
];
25762576
for (str_op, op) in pg_unary_ops {
2577-
let select = pg().verified_only_select(&format!("SELECT {}a", &str_op));
2577+
let select = pg().verified_only_select(&format!("SELECT {}a", str_op));
25782578
assert_eq!(
25792579
SelectItem::UnnamedExpr(Expr::UnaryOp {
25802580
op: *op,
@@ -2590,7 +2590,7 @@ fn parse_pg_postfix_factorial() {
25902590
let postfix_factorial = &[("!", UnaryOperator::PGPostfixFactorial)];
25912591

25922592
for (str_op, op) in postfix_factorial {
2593-
let select = pg().verified_only_select(&format!("SELECT a{}", &str_op));
2593+
let select = pg().verified_only_select(&format!("SELECT a{}", str_op));
25942594
assert_eq!(
25952595
SelectItem::UnnamedExpr(Expr::UnaryOp {
25962596
op: *op,

0 commit comments

Comments
 (0)