File: relax-proc-macro.diff

package info (click to toggle)
rust-zbus-macros-1 1.9.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 184 kB
  • sloc: makefile: 2
file content (38 lines) | stat: -rw-r--r-- 945 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -34,7 +34,7 @@ repository = "https://gitlab.freedesktop
 proc-macro = true
 
 [dependencies.proc-macro-crate]
-version = "0.1.4"
+version = "1"
 
 [dependencies.proc-macro2]
 version = "1.0"
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -1,17 +1,16 @@
 use proc_macro2::Span;
-use proc_macro_crate::crate_name;
+use proc_macro_crate::{crate_name, FoundCrate};
 use syn::{
     Attribute, FnArg, Ident, Lit, Meta, MetaList, NestedMeta, Pat, PatIdent, PatType, Result,
 };
 
 pub fn get_zbus_crate_ident() -> Ident {
-    Ident::new(
-        crate_name("zbus")
-            .as_ref()
-            .map(String::as_str)
-            .unwrap_or("zbus"),
-        Span::call_site(),
-    )
+
+if let Ok(FoundCrate::Name(name)) = crate_name("zbus") {
+      Ident::new(&name, Span::call_site())
+    } else {
+        Ident::new("zbus", Span::call_site())
+    }
 }
 
 pub fn arg_ident(arg: &FnArg) -> Option<&Ident> {