Skip to content

Commit 2cd903a

Browse files
Fix clippy lints reported by Rust 1.97
1 parent 3c25129 commit 2cd903a

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
@@ -4763,7 +4763,7 @@ impl fmt::Display for AlterTable {
47634763
if self.only {
47644764
write!(f, "ONLY ")?;
47654765
}
4766-
write!(f, "{} ", &self.name)?;
4766+
write!(f, "{} ", self.name)?;
47674767
if let Some(cluster) = &self.on_cluster {
47684768
write!(f, "ON CLUSTER {cluster} ")?;
47694769
}

‎src/ast/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11824,7 +11824,7 @@ impl fmt::Display for AlterUser {
1182411824
let has_props = !self.set_props.options.is_empty();
1182511825
if has_props {
1182611826
write!(f, " SET")?;
11827-
write!(f, " {}", &self.set_props)?;
11827+
write!(f, " {}", self.set_props)?;
1182811828
}
1182911829
if !self.unset_props.is_empty() {
1183011830
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
@@ -3547,7 +3547,7 @@ pub struct LockClause {
35473547

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

‎src/parser/mod.rs‎

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

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

@@ -13598,7 +13598,7 @@ impl<'a> Parser<'a> {
1359813598
}
1359913599
Token::EOF => break,
1360013600
token => {
13601-
return Err(ParserError::ParserError(format!(
13601+
Err(ParserError::ParserError(format!(
1360213602
"Unexpected token in identifier: {token}"
1360313603
)))?;
1360413604
}
@@ -16876,7 +16876,7 @@ impl<'a> Parser<'a> {
1687616876
where_clause = Some(self.parse_expr()?);
1687716877
} else {
1687816878
let tok = self.peek_token_ref();
16879-
return parser_err!(
16879+
parser_err!(
1688016880
format!(
1688116881
"Expected one of DIMENSIONS, METRICS, FACTS or WHERE, got {}",
1688216882
tok.token

‎tests/sqlparser_common.rs‎

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

17251725
for (str_op, op, dialects) in binary_ops {
1726-
let select = dialects.verified_only_select(&format!("SELECT a {} b", &str_op));
1726+
let select = dialects.verified_only_select(&format!("SELECT a {} b", str_op));
17271727
assert_eq!(
17281728
SelectItem::UnnamedExpr(Expr::BinaryOp {
17291729
left: Box::new(Expr::Identifier(Ident::new("a"))),
@@ -2522,7 +2522,7 @@ fn parse_bitwise_ops() {
25222522
];
25232523

25242524
for (str_op, op, dialects) in bitwise_ops {
2525-
let select = dialects.verified_only_select(&format!("SELECT a {} b", &str_op));
2525+
let select = dialects.verified_only_select(&format!("SELECT a {} b", str_op));
25262526
assert_eq!(
25272527
SelectItem::UnnamedExpr(Expr::BinaryOp {
25282528
left: Box::new(Expr::Identifier(Ident::new("a"))),
@@ -19155,7 +19155,7 @@ fn parse_generic_unary_ops() {
1915519155
("+", UnaryOperator::Plus),
1915619156
];
1915719157
for (str_op, op) in unary_ops {
19158-
let select = verified_only_select(&format!("SELECT {}expr", &str_op));
19158+
let select = verified_only_select(&format!("SELECT {}expr", str_op));
1915919159
assert_eq!(
1916019160
UnnamedExpr(UnaryOp {
1916119161
op: *op,

‎tests/sqlparser_postgres.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,7 +2461,7 @@ fn parse_pg_unary_ops() {
24612461
("@", UnaryOperator::PGAbs),
24622462
];
24632463
for (str_op, op) in pg_unary_ops {
2464-
let select = pg().verified_only_select(&format!("SELECT {}a", &str_op));
2464+
let select = pg().verified_only_select(&format!("SELECT {}a", str_op));
24652465
assert_eq!(
24662466
SelectItem::UnnamedExpr(Expr::UnaryOp {
24672467
op: *op,
@@ -2477,7 +2477,7 @@ fn parse_pg_postfix_factorial() {
24772477
let postfix_factorial = &[("!", UnaryOperator::PGPostfixFactorial)];
24782478

24792479
for (str_op, op) in postfix_factorial {
2480-
let select = pg().verified_only_select(&format!("SELECT a{}", &str_op));
2480+
let select = pg().verified_only_select(&format!("SELECT a{}", str_op));
24812481
assert_eq!(
24822482
SelectItem::UnnamedExpr(Expr::UnaryOp {
24832483
op: *op,

0 commit comments

Comments
 (0)