mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-09-05 21:50:36 +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
|
@ -805,7 +805,7 @@ impl<'a> Parser<'a> {
|
|||
let tok = self.next_token();
|
||||
let key = match tok.token {
|
||||
Token::Word(word) => word.to_ident(),
|
||||
_ => return parser_err!(format!("Expected identifier, found: {}", tok)),
|
||||
_ => return parser_err!(format!("Expected identifier, found: {tok}")),
|
||||
};
|
||||
Ok(Expr::CompositeAccess {
|
||||
expr: Box::new(expr),
|
||||
|
@ -2083,7 +2083,7 @@ impl<'a> Parser<'a> {
|
|||
|
||||
/// Report unexpected token
|
||||
pub fn expected<T>(&self, expected: &str, found: TokenWithLocation) -> Result<T, ParserError> {
|
||||
parser_err!(format!("Expected {}, found: {}", expected, found))
|
||||
parser_err!(format!("Expected {expected}, found: {found}"))
|
||||
}
|
||||
|
||||
/// Look for an expected keyword and consume it if it exists
|
||||
|
@ -2135,7 +2135,7 @@ impl<'a> Parser<'a> {
|
|||
if let Some(keyword) = self.parse_one_of_keywords(keywords) {
|
||||
Ok(keyword)
|
||||
} else {
|
||||
let keywords: Vec<String> = keywords.iter().map(|x| format!("{:?}", x)).collect();
|
||||
let keywords: Vec<String> = keywords.iter().map(|x| format!("{x:?}")).collect();
|
||||
self.expected(
|
||||
&format!("one of {}", keywords.join(" or ")),
|
||||
self.peek_token(),
|
||||
|
@ -2495,7 +2495,7 @@ impl<'a> Parser<'a> {
|
|||
Keyword::ARCHIVE => Ok(Some(CreateFunctionUsing::Archive(uri))),
|
||||
_ => self.expected(
|
||||
"JAR, FILE or ARCHIVE, got {:?}",
|
||||
TokenWithLocation::wrap(Token::make_keyword(format!("{:?}", keyword).as_str())),
|
||||
TokenWithLocation::wrap(Token::make_keyword(format!("{keyword:?}").as_str())),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
@ -4028,7 +4028,7 @@ impl<'a> Parser<'a> {
|
|||
fn parse_literal_char(&mut self) -> Result<char, ParserError> {
|
||||
let s = self.parse_literal_string()?;
|
||||
if s.len() != 1 {
|
||||
return parser_err!(format!("Expect a char, found {:?}", s));
|
||||
return parser_err!(format!("Expect a char, found {s:?}"));
|
||||
}
|
||||
Ok(s.chars().next().unwrap())
|
||||
}
|
||||
|
@ -4107,7 +4107,7 @@ impl<'a> Parser<'a> {
|
|||
// (i.e., it returns the input string).
|
||||
Token::Number(ref n, l) => match n.parse() {
|
||||
Ok(n) => Ok(Value::Number(n, l)),
|
||||
Err(e) => parser_err!(format!("Could not parse '{}' as number: {}", n, e)),
|
||||
Err(e) => parser_err!(format!("Could not parse '{n}' as number: {e}")),
|
||||
},
|
||||
Token::SingleQuotedString(ref s) => Ok(Value::SingleQuotedString(s.to_string())),
|
||||
Token::DoubleQuotedString(ref s) => Ok(Value::DoubleQuotedString(s.to_string())),
|
||||
|
@ -4147,7 +4147,7 @@ impl<'a> Parser<'a> {
|
|||
let next_token = self.next_token();
|
||||
match next_token.token {
|
||||
Token::Number(s, _) => s.parse::<u64>().map_err(|e| {
|
||||
ParserError::ParserError(format!("Could not parse '{}' as u64: {}", s, e))
|
||||
ParserError::ParserError(format!("Could not parse '{s}' as u64: {e}"))
|
||||
}),
|
||||
_ => self.expected("literal int", next_token),
|
||||
}
|
||||
|
@ -5267,8 +5267,7 @@ impl<'a> Parser<'a> {
|
|||
Keyword::EVENT => Ok(ShowCreateObject::Event),
|
||||
Keyword::VIEW => Ok(ShowCreateObject::View),
|
||||
keyword => Err(ParserError::ParserError(format!(
|
||||
"Unable to map keyword to ShowCreateObject: {:?}",
|
||||
keyword
|
||||
"Unable to map keyword to ShowCreateObject: {keyword:?}"
|
||||
))),
|
||||
}?;
|
||||
|
||||
|
@ -5437,8 +5436,7 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
_ => {
|
||||
return Err(ParserError::ParserError(format!(
|
||||
"expected OUTER, SEMI, ANTI or JOIN after {:?}",
|
||||
kw
|
||||
"expected OUTER, SEMI, ANTI or JOIN after {kw:?}"
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
@ -5561,8 +5559,7 @@ impl<'a> Parser<'a> {
|
|||
// but not `FROM (mytable AS alias1) AS alias2`.
|
||||
if let Some(inner_alias) = alias {
|
||||
return Err(ParserError::ParserError(format!(
|
||||
"duplicate alias {}",
|
||||
inner_alias
|
||||
"duplicate alias {inner_alias}"
|
||||
)));
|
||||
}
|
||||
// Act as if the alias was specified normally next
|
||||
|
@ -5731,8 +5728,7 @@ impl<'a> Parser<'a> {
|
|||
if !err.is_empty() {
|
||||
let errors: Vec<Keyword> = err.into_iter().filter_map(|x| x.err()).collect();
|
||||
return Err(ParserError::ParserError(format!(
|
||||
"INTERNAL ERROR: GRANT/REVOKE unexpected keyword(s) - {:?}",
|
||||
errors
|
||||
"INTERNAL ERROR: GRANT/REVOKE unexpected keyword(s) - {errors:?}"
|
||||
)));
|
||||
}
|
||||
let act = actions.into_iter().filter_map(|x| x.ok()).collect();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue