Skip to content

Commit

Permalink
Removed unnecessary clones
Browse files Browse the repository at this point in the history
  • Loading branch information
zesterer committed Oct 21, 2024
1 parent e6a99eb commit bb22a59
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/combinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2559,7 +2559,7 @@ where
{
#[inline(always)]
fn go<M: Mode>(&self, inp: &mut InputRef<'a, '_, I, E>) -> PResult<M, O> {
let before = inp.save().clone();
let before = inp.save();
match self.parser.go::<M>(inp) {
Ok(out) => {
inp.rewind(before);
Expand Down Expand Up @@ -2739,7 +2739,7 @@ where
// where
// Self: Sized,
// {
// let before = inp.save().clone();
// let before = inp.save();
// match self.parser.go::<M>(inp) {
// Ok(out) => Ok(out),
// Err(()) => {
Expand Down
18 changes: 9 additions & 9 deletions src/primitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ where
{
#[inline]
fn go<M: Mode>(&self, inp: &mut InputRef<'a, '_, I, E>) -> PResult<M, ()> {
let before = inp.cursor().clone();
let before = inp.cursor();
match inp.next_maybe_inner() {
None => Ok(M::bind(|| ())),
Some(tok) => {
Expand Down Expand Up @@ -261,7 +261,7 @@ where
{
#[inline]
fn go<M: Mode>(&self, inp: &mut InputRef<'a, '_, I, E>) -> PResult<M, I::Token> {
let before = inp.cursor().clone();
let before = inp.cursor();
match inp.next_inner() {
#[allow(suspicious_double_ref_op)] // Is this a clippy bug?
Some(tok) if self.seq.contains(tok.borrow()) => Ok(M::bind(|| tok)),
Expand Down Expand Up @@ -335,7 +335,7 @@ where
{
#[inline]
fn go<M: Mode>(&self, inp: &mut InputRef<'a, '_, I, E>) -> PResult<M, I::Token> {
let before = inp.cursor().clone();
let before = inp.cursor();
match inp.next_inner() {
// #[allow(suspicious_double_ref_op)] // Is this a clippy bug?
Some(tok) if !self.seq.contains(tok.borrow()) => Ok(M::bind(|| tok)),
Expand Down Expand Up @@ -401,7 +401,7 @@ where
{
#[inline]
fn go<M: Mode>(&self, inp: &mut InputRef<'a, '_, I, E>) -> PResult<M, O> {
let before = inp.cursor().clone();
let before = inp.cursor();
match (self.f)(inp) {
Ok(out) => Ok(M::bind(|| out)),
Err(err) => {
Expand Down Expand Up @@ -454,7 +454,7 @@ where
{
#[inline]
fn go<M: Mode>(&self, inp: &mut InputRef<'a, '_, I, E>) -> PResult<M, O> {
let before = inp.cursor().clone();
let before = inp.cursor();
let next = inp.next_inner();
let err_span = inp.span_since(&before);
let found = match next {
Expand Down Expand Up @@ -511,7 +511,7 @@ where
{
#[inline]
fn go<M: Mode>(&self, inp: &mut InputRef<'a, '_, I, E>) -> PResult<M, O> {
let before = inp.cursor().clone();
let before = inp.cursor();
let next = inp.next_ref_inner();
let found = match next {
Some(tok) => match (self.filter)(tok, &mut MapExtra::new(&before, inp)) {
Expand Down Expand Up @@ -548,7 +548,7 @@ where
{
#[inline]
fn go<M: Mode>(&self, inp: &mut InputRef<'a, '_, I, E>) -> PResult<M, I::Token> {
let before = inp.cursor().clone();
let before = inp.cursor();
match inp.next_inner() {
Some(tok) => Ok(M::bind(|| tok)),
found => {
Expand Down Expand Up @@ -603,7 +603,7 @@ where
{
#[inline]
fn go<M: Mode>(&self, inp: &mut InputRef<'a, '_, I, E>) -> PResult<M, &'a I::Token> {
let before = inp.cursor().clone();
let before = inp.cursor();
match inp.next_ref_inner() {
Some(tok) => Ok(M::bind(|| tok)),
found => {
Expand Down Expand Up @@ -883,7 +883,7 @@ macro_rules! impl_choice_for_tuple {
{
#[inline]
fn go<M: Mode>(&self, inp: &mut InputRef<'a, '_, I, E>) -> PResult<M, O> {
let before = inp.save().clone();
let before = inp.save();

let Choice { parsers: ($Head, $($X,)*), .. } = self;

Expand Down
2 changes: 1 addition & 1 deletion src/recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ where
S: Strategy<'a, I, O, E>,
{
fn go<M: Mode>(&self, inp: &mut InputRef<'a, '_, I, E>) -> PResult<M, O> {
let before = inp.save().clone();
let before = inp.save();
match self.parser.go::<M>(inp) {
Ok(out) => Ok(out),
Err(()) => {
Expand Down

0 comments on commit bb22a59

Please sign in to comment.