Skip to content

Commit

Permalink
Remove unnecessary clones
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasbb authored and TedDriggs committed Apr 27, 2023
1 parent fba6466 commit 8097397
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/src/codegen/attr_extractor.rs
Expand Up @@ -55,7 +55,7 @@ pub trait ExtractAttribute {
#(#attr_names)|* => {
match ::darling::util::parse_attribute_to_meta_list(__attr) {
::darling::export::Ok(__data) => {
match ::darling::export::NestedMeta::parse_meta_list(__data.tokens.clone()) {
match ::darling::export::NestedMeta::parse_meta_list(__data.tokens) {
::darling::export::Ok(ref __items) => {
if __items.is_empty() {
continue;
Expand Down
4 changes: 2 additions & 2 deletions core/src/util/parse_attribute.rs
Expand Up @@ -61,14 +61,14 @@ mod tests {
#[test]
fn parse_list() {
let meta = parse_attribute_to_meta_list(&parse_quote!(#[bar(baz = 4)])).unwrap();
let nested_meta = NestedMeta::parse_meta_list(meta.tokens.clone()).unwrap();
let nested_meta = NestedMeta::parse_meta_list(meta.tokens).unwrap();
assert_eq!(nested_meta.len(), 1);
}

#[test]
fn parse_path_returns_empty_list() {
let meta = parse_attribute_to_meta_list(&parse_quote!(#[bar])).unwrap();
let nested_meta = NestedMeta::parse_meta_list(meta.tokens.clone()).unwrap();
let nested_meta = NestedMeta::parse_meta_list(meta.tokens).unwrap();
assert!(meta.path.is_ident(&Ident::new("bar", meta.path.span())));
assert!(nested_meta.is_empty());
}
Expand Down

0 comments on commit 8097397

Please sign in to comment.