Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use Path::is_ident() helper
Co-authored-by: Bastian Köcher <[email protected]>
  • Loading branch information
coriolinus and bkchr authored Jun 23, 2021
commit 5189f843e32d0b760c2b5cf5e0437f5b7459c141
4 changes: 2 additions & 2 deletions derive/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ fn crate_access() -> syn::Result<Ident> {
/// Match `#[codec(crate = ...)]` and return the `...`
fn codec_crate_path_lit(attr: &Attribute) -> Option<Lit> {
// match `#[codec ...]`
if attr.path != parse_quote!(codec) {
if !attr.path.is_ident("codec") {
return None;
};
// match `#[codec(crate = ...)]` and return the `...`
match attr.parse_meta() {
Ok(Meta::NameValue(MetaNameValue { path, lit, .. })) if path == parse_quote!(crate) => {
Ok(Meta::NameValue(MetaNameValue { path, lit, .. })) if path.is_ident("crate") => {
Some(lit)
}
_ => None,
Expand Down