tower-web icon indicating copy to clipboard operation
tower-web copied to clipboard

2018 edition of Rust requires a bunch of imports

Open berkus opened this issue 7 years ago • 4 comments

To use impl_web! in rust-2018 requires typing in this monstrocity:

use tower_web::{
    derive_resource, derive_resource_impl, impl_web, impl_web_clean_nested,
    impl_web_clean_top_level,
};

Is there perhaps a cleaner way?

berkus avatar Aug 23 '18 12:08 berkus

@dtolnay how is Serde handling similar issues?

shepmaster avatar Aug 23 '18 13:08 shepmaster

We use https://github.com/rust-lang/rust/pull/51496.

dtolnay avatar Aug 23 '18 13:08 dtolnay

I've managed to use the #[macro_export(local_inner_macros)] to make it possible in the 2018 edition to import only: use tower_web::{derive_resource_impl, impl_web};

It still requires the derive_resource_impl to be imported, sadly that's where my skills fall short. You may see the changes here, but it would be nice to be able to import only impl_web or drop it as a whole as the #194 issue

https://github.com/elpiel/tower-web/compare/edition-2018...elpiel:macro-fixes-for-2018-edition?expand=1

elpiel avatar May 08 '19 15:05 elpiel

Thanks @elpiel!

berkus avatar May 10 '19 10:05 berkus