apache / apache/datafusion-sqlparser-rs

Rename VisitorMut::visit to VisitorMut::visit_mut

Open
#2,067 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
3.5k
Forks
772
Avg merge
4d 9h
Merged PRs (30d)
17

Description

There're cases we need to use `Visitor::visit` and `VisitorMut::visit` in the same context. Since they're of the same name, compiler would be confused.

For example:

``` Rust
impl Visitor For NoopVisitor { .. }
impl VisitorMut for NoopVisitorMut { .. }

let mut visitor = NoopVisitor {};
let _ = stmt.visit(&mut visitor);

let mut visitor_mut = NoopVisitorMut {};
let _ = stmt.visit(&mut visitor_mut);
```

Would raise the error:
```
the trait bound `NoopVisitorMut: sqlparser::ast::Visitor` is not satisfied
the trait `sqlparser::ast::Visitor` is implemented for `NoopVisitor`
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Search the repository for the VisitorMut trait and its visit method, then trace the implementations and call sites shown by those matches. Rename the method consistently and verify that Visitor and VisitorMut can be used in the same context without the reported trait-bound error; run the relevant existing Rust tests or checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.