From 36ffc1fd521c886670f9c218e231571c7e9feac9 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Thu, 5 Oct 2023 15:21:54 -0400 Subject: [PATCH] Fix for clippy 1.73 --- src/ast/mod.rs | 2 +- src/ast/visitor.rs | 2 +- src/parser/mod.rs | 12 ++++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/ast/mod.rs b/src/ast/mod.rs index 6f9d32c8d..d4e2f26ea 100644 --- a/src/ast/mod.rs +++ b/src/ast/mod.rs @@ -155,7 +155,7 @@ impl fmt::Display for Ident { let escaped = value::escape_quoted_string(&self.value, q); write!(f, "{q}{escaped}{q}") } - Some(q) if q == '[' => write!(f, "[{}]", self.value), + Some('[') => write!(f, "[{}]", self.value), None => f.write_str(&self.value), _ => panic!("unexpected quote style"), } diff --git a/src/ast/visitor.rs b/src/ast/visitor.rs index bb7c19678..09cb20a0c 100644 --- a/src/ast/visitor.rs +++ b/src/ast/visitor.rs @@ -490,7 +490,7 @@ where /// /// This demonstrates how to effectively replace an expression with another more complicated one /// that references the original. This example avoids unnecessary allocations by using the -/// [`std::mem`](std::mem) family of functions. +/// [`std::mem`] family of functions. /// /// ``` /// # use sqlparser::parser::Parser; diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 5f6788696..d0b3cef78 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -4701,7 +4701,11 @@ impl<'a> Parser<'a> { pub fn parse_literal_string(&mut self) -> Result { let next_token = self.next_token(); match next_token.token { - Token::Word(Word { value, keyword, .. }) if keyword == Keyword::NoKeyword => Ok(value), + Token::Word(Word { + value, + keyword: Keyword::NoKeyword, + .. + }) => Ok(value), Token::SingleQuotedString(s) => Ok(s), Token::DoubleQuotedString(s) => Ok(s), Token::EscapedStringLiteral(s) if dialect_of!(self is PostgreSqlDialect | GenericDialect) => { @@ -5853,8 +5857,8 @@ impl<'a> Parser<'a> { self.expect_token(&Token::Colon)?; } else if self.parse_keyword(Keyword::ROLE) { let context_modifier = match modifier { - Some(keyword) if keyword == Keyword::LOCAL => ContextModifier::Local, - Some(keyword) if keyword == Keyword::SESSION => ContextModifier::Session, + Some(Keyword::LOCAL) => ContextModifier::Local, + Some(Keyword::SESSION) => ContextModifier::Session, _ => ContextModifier::None, }; @@ -6897,7 +6901,7 @@ impl<'a> Parser<'a> { } } - /// Parse an [`WildcardAdditionalOptions`](WildcardAdditionalOptions) information for wildcard select items. + /// Parse an [`WildcardAdditionalOptions`] information for wildcard select items. /// /// If it is not possible to parse it, will return an option. pub fn parse_wildcard_additional_options(