Skip to content

Commit

Permalink
Less brittle matching of cxx::bridge path
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Aug 29, 2020
1 parent dab7e80 commit 020c923
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions gen/src/find.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::gen::{Error, Input, Result};
use crate::syntax::namespace::Namespace;
use quote::quote;
use syn::{Attribute, File, Item};

pub(super) fn find_bridge_mod(syntax: File) -> Result<Input> {
Expand All @@ -14,8 +13,8 @@ fn scan(items: Vec<Item>) -> Result<Option<Input>> {
for item in items {
if let Item::Mod(item) = item {
for attr in &item.attrs {
let path = &attr.path;
if quote!(#path).to_string() == "cxx :: bridge" {
let path = &attr.path.segments;
if path.len() == 2 && path[0].ident == "cxx" && path[1].ident == "bridge" {
let module = match item.content {
Some(module) => module.1,
None => {
Expand Down

0 comments on commit 020c923

Please sign in to comment.