Skip to content

Commit

Permalink
Resolve needless_borrow clippy lint
Browse files Browse the repository at this point in the history
    error: this expression borrows a reference (`&syn::parse::ParseBuffer`) that is immediately dereferenced by the compiler
      --> tests/test_parse_buffer.rs:15:35
       |
    15 |                 input1.advance_to(&input2);
       |                                   ^^^^^^^ help: change this to: `input2`
       |
       = note: `-D clippy::needless-borrow` implied by `-D clippy::all`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
  • Loading branch information
dtolnay committed Sep 30, 2021
1 parent 2de9ea7 commit 4366423
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/test_parse_buffer.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(clippy::needless_borrow, clippy::non_ascii_literal)]
#![allow(clippy::non_ascii_literal)]

use proc_macro2::{Delimiter, Group, Punct, Spacing, TokenStream, TokenTree};
use std::iter::FromIterator;
Expand All @@ -12,7 +12,7 @@ fn smuggled_speculative_cursor_between_sources() {
impl Parse for BreakRules {
fn parse(input1: ParseStream) -> Result<Self> {
let nested = |input2: ParseStream| {
input1.advance_to(&input2);
input1.advance_to(input2);
Ok(Self)
};
nested.parse_str("")
Expand Down

0 comments on commit 4366423

Please sign in to comment.