Skip to content

Commit 020c923

Browse files
committed
Less brittle matching of cxx::bridge path
1 parent dab7e80 commit 020c923

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

gen/src/find.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::gen::{Error, Input, Result};
22
use crate::syntax::namespace::Namespace;
3-
use quote::quote;
43
use syn::{Attribute, File, Item};
54

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

0 commit comments

Comments
 (0)