Skip to content

Commit 93c9ee3

Browse files
authored
Disable unused-import warnings on __with_name* aliases. (#1372)
* Disable unused-import warnings on `__with_name*` aliases. These don't always get used, so disable unused-import warnings for them. * Disable unused_lint_expectations warnings too; sometimes the aliases are used. * rustfmt * Fix more warnings.
1 parent 1ee3108 commit 93c9ee3

File tree

2 files changed

+4
-5
lines changed
  • crates/rust/src
  • tests/runtime/rust/with-only-affects-imports

2 files changed

+4
-5
lines changed

crates/rust/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,10 @@ impl RustWasm {
398398
TypeGeneration::Remap(remapped_path) => {
399399
let name = format!("__with_name{}", self.with_name_counter);
400400
self.with_name_counter += 1;
401+
uwriteln!(
402+
self.src,
403+
"#[allow(unfulfilled_lint_expectations, unused_imports)]"
404+
);
401405
uwriteln!(self.src, "use {remapped_path} as {name};");
402406
InterfaceName {
403407
remapped: true,

tests/runtime/rust/with-only-affects-imports/test.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
//@ args = '--with my:inline/foo=other::my::inline::foo'
22

3-
#![expect(
4-
unused_imports,
5-
reason = "using `with` is known to produce possibly dead imports"
6-
)]
7-
83
include!(env!("BINDINGS"));
94

105
mod other {

0 commit comments

Comments
 (0)