Skip to content

Commit

Permalink
Merge pull request #15 from hoodie/feature/update-syn
Browse files Browse the repository at this point in the history
update syn again
  • Loading branch information
koivunej authored Oct 22, 2023
2 parents 84adb29 + 3bd9431 commit d3b3128
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ edition = "2021"
proc-macro = true

[dependencies]
syn = "1"
syn = "2"
quote = "1"
proc-macro2 = "1"
20 changes: 10 additions & 10 deletions src/helpers.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::field_kind::FieldKind;

pub fn has_lifetime_arguments(segments: &[syn::PathSegment]) -> bool {
if let Some(&syn::PathArguments::AngleBracketed(ref generics)) =
if let Some(syn::PathArguments::AngleBracketed(generics)) =
segments.last().map(|x| &x.arguments)
{
generics
Expand All @@ -14,7 +14,7 @@ pub fn has_lifetime_arguments(segments: &[syn::PathSegment]) -> bool {
}

pub fn number_of_type_arguments(segments: &[syn::PathSegment]) -> usize {
if let Some(&syn::PathArguments::AngleBracketed(ref generics)) =
if let Some(syn::PathArguments::AngleBracketed(generics)) =
segments.last().map(|x| &x.arguments)
{
generics
Expand All @@ -28,13 +28,15 @@ pub fn number_of_type_arguments(segments: &[syn::PathSegment]) -> usize {
}

pub fn has_binding_arguments(segments: &[syn::PathSegment]) -> bool {
if let Some(&syn::PathArguments::AngleBracketed(ref generics)) =
if let Some(syn::PathArguments::AngleBracketed(generics)) =
segments.last().map(|x| &x.arguments)
{
generics
.args
.iter()
.any(|f| matches!(f, syn::GenericArgument::Binding(_)))
generics.args.iter().any(|f| {
matches!(
f,
syn::GenericArgument::AssocConst(_) | syn::GenericArgument::AssocType(_)
)
})
} else {
false
}
Expand Down Expand Up @@ -66,9 +68,7 @@ pub fn is_cow(segments: &[syn::PathSegment]) -> bool {
}

pub fn is_cow_alike(segments: &[syn::PathSegment]) -> bool {
if let Some(&syn::PathArguments::AngleBracketed(ref _data)) =
segments.last().map(|x| &x.arguments)
{
if let Some(syn::PathArguments::AngleBracketed(_data)) = segments.last().map(|x| &x.arguments) {
has_lifetime_arguments(segments)
} else {
false
Expand Down
2 changes: 1 addition & 1 deletion tests/borrowed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ fn borrowed() {

fn test<'b, 'a: 'b>(lives_longer: &Foo<'a>, lives_less: Foo<'b>) {
drop(lives_less);
#[allow(clippy::drop_ref)]
#[allow(dropping_references)]
drop(lives_longer);
}

0 comments on commit d3b3128

Please sign in to comment.