mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-16 04:00:15 +00:00
chore: fix clippy error in ci (#803)
* chore: fix clippy error in ci * chore: fix fmt
This commit is contained in:
parent
4955863bdf
commit
b31ede7733
16 changed files with 371 additions and 444 deletions
|
@ -180,17 +180,17 @@ impl fmt::Display for Token {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
Token::EOF => f.write_str("EOF"),
|
||||
Token::Word(ref w) => write!(f, "{}", w),
|
||||
Token::Word(ref w) => write!(f, "{w}"),
|
||||
Token::Number(ref n, l) => write!(f, "{}{long}", n, long = if *l { "L" } else { "" }),
|
||||
Token::Char(ref c) => write!(f, "{}", c),
|
||||
Token::SingleQuotedString(ref s) => write!(f, "'{}'", s),
|
||||
Token::DoubleQuotedString(ref s) => write!(f, "\"{}\"", s),
|
||||
Token::DollarQuotedString(ref s) => write!(f, "{}", s),
|
||||
Token::NationalStringLiteral(ref s) => write!(f, "N'{}'", s),
|
||||
Token::EscapedStringLiteral(ref s) => write!(f, "E'{}'", s),
|
||||
Token::HexStringLiteral(ref s) => write!(f, "X'{}'", s),
|
||||
Token::Char(ref c) => write!(f, "{c}"),
|
||||
Token::SingleQuotedString(ref s) => write!(f, "'{s}'"),
|
||||
Token::DoubleQuotedString(ref s) => write!(f, "\"{s}\""),
|
||||
Token::DollarQuotedString(ref s) => write!(f, "{s}"),
|
||||
Token::NationalStringLiteral(ref s) => write!(f, "N'{s}'"),
|
||||
Token::EscapedStringLiteral(ref s) => write!(f, "E'{s}'"),
|
||||
Token::HexStringLiteral(ref s) => write!(f, "X'{s}'"),
|
||||
Token::Comma => f.write_str(","),
|
||||
Token::Whitespace(ws) => write!(f, "{}", ws),
|
||||
Token::Whitespace(ws) => write!(f, "{ws}"),
|
||||
Token::DoubleEq => f.write_str("=="),
|
||||
Token::Spaceship => f.write_str("<=>"),
|
||||
Token::Eq => f.write_str("="),
|
||||
|
@ -232,7 +232,7 @@ impl fmt::Display for Token {
|
|||
Token::ShiftRight => f.write_str(">>"),
|
||||
Token::PGSquareRoot => f.write_str("|/"),
|
||||
Token::PGCubeRoot => f.write_str("||/"),
|
||||
Token::Placeholder(ref s) => write!(f, "{}", s),
|
||||
Token::Placeholder(ref s) => write!(f, "{s}"),
|
||||
Token::Arrow => write!(f, "->"),
|
||||
Token::LongArrow => write!(f, "->>"),
|
||||
Token::HashArrow => write!(f, "#>"),
|
||||
|
@ -323,8 +323,8 @@ impl fmt::Display for Whitespace {
|
|||
Whitespace::Space => f.write_str(" "),
|
||||
Whitespace::Newline => f.write_str("\n"),
|
||||
Whitespace::Tab => f.write_str("\t"),
|
||||
Whitespace::SingleLineComment { prefix, comment } => write!(f, "{}{}", prefix, comment),
|
||||
Whitespace::MultiLineComment(s) => write!(f, "/*{}*/", s),
|
||||
Whitespace::SingleLineComment { prefix, comment } => write!(f, "{prefix}{comment}"),
|
||||
Whitespace::MultiLineComment(s) => write!(f, "/*{s}*/"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -595,13 +595,13 @@ impl<'a> Tokenizer<'a> {
|
|||
} else {
|
||||
self.tokenizer_error(
|
||||
error_loc,
|
||||
format!("Expected close delimiter '{}' before EOF.", quote_end),
|
||||
format!("Expected close delimiter '{quote_end}' before EOF."),
|
||||
)
|
||||
}
|
||||
}
|
||||
// numbers and period
|
||||
'0'..='9' | '.' => {
|
||||
let mut s = peeking_take_while(chars, |ch| matches!(ch, '0'..='9'));
|
||||
let mut s = peeking_take_while(chars, |ch| ch.is_ascii_digit());
|
||||
|
||||
// match binary literal that starts with 0x
|
||||
if s == "0" && chars.peek() == Some(&'x') {
|
||||
|
@ -618,7 +618,7 @@ impl<'a> Tokenizer<'a> {
|
|||
s.push('.');
|
||||
chars.next();
|
||||
}
|
||||
s += &peeking_take_while(chars, |ch| matches!(ch, '0'..='9'));
|
||||
s += &peeking_take_while(chars, |ch| ch.is_ascii_digit());
|
||||
|
||||
// No number -> Token::Period
|
||||
if s == "." {
|
||||
|
@ -642,12 +642,12 @@ impl<'a> Tokenizer<'a> {
|
|||
|
||||
match char_clone.peek() {
|
||||
// Definitely an exponent, get original iterator up to speed and use it
|
||||
Some(&c) if matches!(c, '0'..='9') => {
|
||||
Some(&c) if c.is_ascii_digit() => {
|
||||
for _ in 0..exponent_part.len() {
|
||||
chars.next();
|
||||
}
|
||||
exponent_part +=
|
||||
&peeking_take_while(chars, |ch| matches!(ch, '0'..='9'));
|
||||
&peeking_take_while(chars, |ch| ch.is_ascii_digit());
|
||||
s += exponent_part.as_str();
|
||||
}
|
||||
// Not an exponent, discard the work done
|
||||
|
@ -907,8 +907,7 @@ impl<'a> Tokenizer<'a> {
|
|||
return self.tokenizer_error(
|
||||
chars.location(),
|
||||
format!(
|
||||
"Unterminated dollar-quoted string at or near \"{}\"",
|
||||
value
|
||||
"Unterminated dollar-quoted string at or near \"{value}\""
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue