Skip to content

Commit

Permalink
warn on deprecated itemlist imports
Browse files Browse the repository at this point in the history
  • Loading branch information
robtfm committed Oct 18, 2023
1 parent cce4144 commit da0891d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ repository = "https://github.com/bevyengine/naga_oil/"
readme = "README.md"

[features]
default = ["test_shader"]
default = ["test_shader", "warn_deprecated"]
# enable tests that need a graphical card
test_shader = []
prune = []
override_any = []
warn_deprecated = []

[dependencies]
naga = { version = "0.13", features = ["wgsl-in", "wgsl-out", "glsl-in", "glsl-out", "clone", "span"] }
Expand Down
5 changes: 5 additions & 0 deletions src/compose/parse_imports.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::collections::HashMap;

use tracing::warn;

use super::{
tokenizer::{Token, Tokenizer},
Composer, ImportDefWithOffset, ImportDefinition,
Expand Down Expand Up @@ -44,6 +46,9 @@ pub fn parse_imports<'a>(

// support deprecated #import mod item
if let Some(Token::Identifier(..)) = tokens.peek() {
#[cfg(feature="warn_deprecated")]
warn!("item list imports are deprecated, please use `rust::style::item_imports;`\n| {}", input);

is_deprecated_itemlist = true;
stack.push(format!("{}::", current));
current = String::default();
Expand Down

0 comments on commit da0891d

Please sign in to comment.