mirror of
https://gitee.com/openharmony/third_party_rust_proc-macro2
synced 2024-11-27 01:20:48 +00:00
Resolve redundant_clone clippy lint
error: redundant clone --> tests/test_fmt.rs:17:58 | 17 | let none_nonempty = Group::new(Delimiter::None, inner.clone()); | ^^^^^^^^ help: remove this | = note: `-D clippy::redundant-clone` implied by `-D clippy::all` note: this value is dropped without further use --> tests/test_fmt.rs:17:53 | 17 | let none_nonempty = Group::new(Delimiter::None, inner.clone()); | ^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone error: could not compile `proc-macro2` due to previous error warning: build failed, waiting for other jobs to finish... error: redundant clone --> tests/test.rs:188:19 | 188 | let s2 = s.to_string().parse::<TokenStream>().unwrap().to_string(); | ^^^^^^^^^^^^ help: remove this | = note: `-D clippy::redundant-clone` implied by `-D clippy::all` note: cloned value is neither consumed nor mutated --> tests/test.rs:188:18 | 188 | let s2 = s.to_string().parse::<TokenStream>().unwrap().to_string(); | ^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone
This commit is contained in:
parent
4565d979c3
commit
1beb3104c1
@ -1,4 +1,4 @@
|
||||
#![allow(clippy::redundant_clone, clippy::default_trait_access)]
|
||||
#![allow(clippy::default_trait_access)]
|
||||
|
||||
use proc_macro2::{Ident, Literal, Punct, Spacing, Span, TokenStream, TokenTree};
|
||||
use std::panic;
|
||||
@ -185,7 +185,7 @@ fn roundtrip() {
|
||||
println!("parse: {}", p);
|
||||
let s = p.parse::<TokenStream>().unwrap().to_string();
|
||||
println!("first: {}", s);
|
||||
let s2 = s.to_string().parse::<TokenStream>().unwrap().to_string();
|
||||
let s2 = s.parse::<TokenStream>().unwrap().to_string();
|
||||
assert_eq!(s, s2);
|
||||
}
|
||||
roundtrip("a");
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![allow(clippy::redundant_clone, clippy::from_iter_instead_of_collect)]
|
||||
#![allow(clippy::from_iter_instead_of_collect)]
|
||||
|
||||
use proc_macro2::{Delimiter, Group, Ident, Span, TokenStream, TokenTree};
|
||||
use std::iter::{self, FromIterator};
|
||||
@ -14,7 +14,7 @@ fn test_fmt_group() {
|
||||
let braces_empty = Group::new(Delimiter::Brace, TokenStream::new());
|
||||
let braces_nonempty = Group::new(Delimiter::Brace, inner.clone());
|
||||
let none_empty = Group::new(Delimiter::None, TokenStream::new());
|
||||
let none_nonempty = Group::new(Delimiter::None, inner.clone());
|
||||
let none_nonempty = Group::new(Delimiter::None, inner);
|
||||
|
||||
// Matches libproc_macro.
|
||||
assert_eq!("()", parens_empty.to_string());
|
||||
|
Loading…
Reference in New Issue
Block a user