diff --git a/src/expand.rs b/src/expand.rs index 9dfc895..6d17deb 100644 --- a/src/expand.rs +++ b/src/expand.rs @@ -321,6 +321,7 @@ fn transform_block( #(#stmts)* }; + #[allow(unreachable_code)] __ret }) ); diff --git a/tests/test.rs b/tests/test.rs index fe0d8f0..80e44e5 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -216,7 +216,6 @@ pub async fn test_internal_items() { pub async fn test_unimplemented() { #[async_trait] - #[allow(unreachable_code)] pub trait Trait { async fn f() { unimplemented!() diff --git a/tests/ui/unreachable.rs b/tests/ui/unreachable.rs new file mode 100644 index 0000000..f546a58 --- /dev/null +++ b/tests/ui/unreachable.rs @@ -0,0 +1,20 @@ +#![deny(warnings)] + +use async_trait::async_trait; + +#[async_trait] +pub trait Trait { + async fn f() { + unimplemented!() + } +} + +#[async_trait] +pub trait TraitFoo { + async fn f() { + let y = unimplemented!(); + let z = y; + } +} + +fn main() {}