diff options
author | 2022-02-22 17:47:48 +0000 | |
---|---|---|
committer | 2022-02-22 17:47:48 +0000 | |
commit | 57da1e0403510cafbdcf88e402b39ae6d3bf323e (patch) | |
tree | c02bd08b8d6b73983048971bbecf1cd57ca782d1 /macros/src | |
parent | 110a82f7b6a229f0c563b1dd67b5381ba0e308d1 (diff) | |
parent | 7eaf732c4c2839da0d352dfc080e107828cdadd4 (diff) | |
download | rtic-57da1e0403510cafbdcf88e402b39ae6d3bf323e.tar.gz rtic-57da1e0403510cafbdcf88e402b39ae6d3bf323e.tar.zst rtic-57da1e0403510cafbdcf88e402b39ae6d3bf323e.zip |
Merge #616
616: rtic::mutex::prelude::* fixes glob import lint r=korken89 a=AfoHT
Running cargo Clippy with pedantic rules denied
```
cargo clippy -- --deny clippy::pedantic
```
it will complain:
```
error: usage of wildcard import
|
16 | use rtic::mutex_prelude::*;
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `rtic::mutex_prelude::{Mutex, TupleExt01, TupleExt02, TupleExt03, TupleExt04, TupleExt05, TupleExt06, TupleExt07, TupleExt08, TupleExt09, TupleExt10, TupleExt11, TupleExt12, TupleExt13, TupleExt14, TupleExt15, TupleExt16, TupleExt17, TupleExt18, TupleExt19, TupleExt20, TupleExt21, TupleExt22, TupleExt23, TupleExt24, TupleExt25, TupleExt26, TupleExt27, TupleExt28, TupleExt29, TupleExt30, TupleExt31, TupleExt32}`
|
= note: `-D clippy::wildcard-imports` implied by `-D clippy::pedantic`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wildcard_imports
error: could not compile --- due to previous error
Error: command `cargo clippy -- --deny clippy::all --deny clippy::pedantic` failed, exit status: 101
```
Looking at the Clippy [wildcard-imports rule](https://rust-lang.github.io/rust-clippy/master/#wildcard_imports)
the exception is for wildcards on modules named prelude. Thus, `prelude::*` is OK.
Current state: `use rtic-core::prelude as mutex_prelude` almost fits the bill, but `mutex_prelude != prelude`.
As this was part of user facing API I don’t think we can remove the current setup,
so rtic-core `Mutex`, `Exclusive` and multi-lock `TupleExt0X` retained in
old location to be backwards compatible.
Co-authored-by: Henrik Tjäder <henrik@grepit.se>
Diffstat (limited to 'macros/src')
-rw-r--r-- | macros/src/codegen/hardware_tasks.rs | 2 | ||||
-rw-r--r-- | macros/src/codegen/idle.rs | 2 | ||||
-rw-r--r-- | macros/src/codegen/software_tasks.rs | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/macros/src/codegen/hardware_tasks.rs b/macros/src/codegen/hardware_tasks.rs index e6192e2c..f75c71d4 100644 --- a/macros/src/codegen/hardware_tasks.rs +++ b/macros/src/codegen/hardware_tasks.rs @@ -97,7 +97,7 @@ pub fn codegen( #[allow(non_snake_case)] fn #name(#context: #name::Context) { use rtic::Mutex as _; - use rtic::mutex_prelude::*; + use rtic::mutex::prelude::*; #(#stmts)* } diff --git a/macros/src/codegen/idle.rs b/macros/src/codegen/idle.rs index 0dededa4..83b85d7b 100644 --- a/macros/src/codegen/idle.rs +++ b/macros/src/codegen/idle.rs @@ -68,7 +68,7 @@ pub fn codegen( #[allow(non_snake_case)] fn #name(#context: #name::Context) -> ! { use rtic::Mutex as _; - use rtic::mutex_prelude::*; + use rtic::mutex::prelude::*; #(#stmts)* } diff --git a/macros/src/codegen/software_tasks.rs b/macros/src/codegen/software_tasks.rs index c767032f..0357003f 100644 --- a/macros/src/codegen/software_tasks.rs +++ b/macros/src/codegen/software_tasks.rs @@ -131,7 +131,7 @@ pub fn codegen( #[allow(non_snake_case)] fn #name(#context: #name::Context #(,#inputs)*) { use rtic::Mutex as _; - use rtic::mutex_prelude::*; + use rtic::mutex::prelude::*; #(#stmts)* } |