macros: Allow using re-exports of gtk
@@ -6,9 +6,11 @@ use proc_macro_crate::crate_name;
pub fn crate_ident_new() -> Ident {
use proc_macro_crate::FoundCrate;
- let crate_name = match crate_name("gtk4").expect("missing gtk4 dependency in `Cargo.toml`") {
- FoundCrate::Name(name) => name,
- FoundCrate::Itself => "gtk4".to_owned(),
+ // Use crate name detected from Cargo.toml or "gtk" for use in re-exports
+ let crate_name = match crate_name("gtk4") {
+ Ok(FoundCrate::Name(name)) => name,
+ Ok(FoundCrate::Itself) => "gtk4".to_owned(),
+ Err(_) => "gtk".to_owned(),
};
Ident::new(&crate_name, Span::call_site())
