Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary clone on Span #27

Merged
merged 2 commits into from
Aug 14, 2023
Merged

Conversation

veeenu
Copy link
Contributor

@veeenu veeenu commented Aug 13, 2023

Hi!

I started using pest-ast and I was running into the following lint:

warning: using `clone` on type `Span<'_>` which implements the `Copy` trait
   --> src/ast.rs:102:38
    |
102 | ...t_ast(outer(with(span_into_string)))] String);
    |          ^^^^^ help: try removing the `clone` call: `outer`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

Personally I think it is desirable to have it on, so I checked out pest-ast's code and noticed that the first element in the ConversionStrategy::Outer tuple is always a Span, which is Copy and thus shouldn't ever need clone.

I have not delved super deep in the code, though, so I'm not 100% confident on this statement: have I overlooked something?

I also changed the example slightly, removing the need for allowing lints altogether. Hth!

@tomtau tomtau merged commit 09255d7 into pest-parser:master Aug 14, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants