diff --git a/crates/stef-build/src/definition.rs b/crates/stef-build/src/definition.rs index af8bdb8..377a7ad 100644 --- a/crates/stef-build/src/definition.rs +++ b/crates/stef-build/src/definition.rs @@ -199,7 +199,8 @@ fn compile_import(Import { segments, element }: &Import<'_>) -> TokenStream { }); quote! { - use #(#segments)*#element; + #[allow(unused_imports)] + use super::#(#segments)*#element; } } diff --git a/crates/stef-build/tests/snapshots/compiler__compile@import_basic.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile@import_basic.stef.snap index 6c4c5bf..bd18da8 100644 --- a/crates/stef-build/tests/snapshots/compiler__compile@import_basic.stef.snap +++ b/crates/stef-build/tests/snapshots/compiler__compile@import_basic.stef.snap @@ -5,6 +5,8 @@ input_file: crates/stef-parser/tests/inputs/import_basic.stef --- #[allow(unused_imports)] use ::stef::buf::{Decode, Encode}; -use other::schema::Sample; -use second::submodule; +#[allow(unused_imports)] +use super::other::schema::Sample; +#[allow(unused_imports)] +use super::second::submodule; diff --git a/crates/stef-build/tests/snapshots/compiler__compile_extra@import.stef.snap b/crates/stef-build/tests/snapshots/compiler__compile_extra@import.stef.snap index 1c31158..f556eb3 100644 --- a/crates/stef-build/tests/snapshots/compiler__compile_extra@import.stef.snap +++ b/crates/stef-build/tests/snapshots/compiler__compile_extra@import.stef.snap @@ -5,6 +5,8 @@ input_file: crates/stef-build/tests/inputs_extra/import.stef --- #[allow(unused_imports)] use ::stef::buf::{Decode, Encode}; -use other::module; -use other::module::Type; +#[allow(unused_imports)] +use super::other::module; +#[allow(unused_imports)] +use super::other::module::Type; diff --git a/crates/stef-playground/src/lib.rs b/crates/stef-playground/src/lib.rs index 3677ae5..6c54085 100644 --- a/crates/stef-playground/src/lib.rs +++ b/crates/stef-playground/src/lib.rs @@ -56,10 +56,17 @@ mod schemas { stef::include!("enum_min_ws"); } - // TODO: implement imports - // mod import_basic { - // stef::include!("import_basic"); - // } + mod import_basic { + stef::include!("import_basic"); + } + + mod other { + stef::include!("other"); + } + + mod second { + stef::include!("second"); + } mod module_basic { stef::include!("module_basic");