alamb commented on code in PR #1624:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/1624#discussion_r1898909440
##########
src/parser/mod.rs:
##########
@@ -970,15 +970,15 @@ impl<'a> Parser<'a> {
t @ (Token::Word(_) | Token::SingleQuotedString(_)) => {
if self.peek_token().token == Token::Period {
let mut id_parts: Vec<Ident> = vec![match t {
- Token::Word(w) => w.to_ident(next_token.span),
+ Token::Word(w) => w.into_ident(next_token.span),
Review Comment:
`w.to_ident` cloned (copied) the string. `info_ident` simply reuses the
string
##########
src/parser/mod.rs:
##########
@@ -13475,13 +13477,23 @@ impl<'a> Parser<'a> {
}
impl Word {
+ #[deprecated(since = "0.55.0", note = "please use `into_ident` instead")]
pub fn to_ident(&self, span: Span) -> Ident {
Ident {
value: self.value.clone(),
Review Comment:
note `to_indent` clones self.value
##########
src/parser/mod.rs:
##########
@@ -1108,7 +1108,7 @@ impl<'a> Parser<'a> {
if dialect_of!(self is PostgreSqlDialect | GenericDialect) =>
{
Ok(Some(Expr::Function(Function {
- name: ObjectName(vec![w.to_ident(w_span)]),
+ name: ObjectName(vec![w.clone().into_ident(w_span)]),
Review Comment:
in this case I couldn't figure out (yet) how to avoid this clone given that
`&w` is passed in
This PR doesn't increase the number of clones done, but it makes it more
explicit when they are happening
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]