mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-27 14:04:56 +01:00
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>
This commit is contained in:
commit
57da1e0403
5 changed files with 10 additions and 3 deletions
|
@ -21,6 +21,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Re-export `rtic_core::prelude` as `rtic::mutex::prelude` to allow glob imports + Clippy
|
||||||
- Fix dated migration docs for spawn
|
- Fix dated migration docs for spawn
|
||||||
- Remove obsolete action-rs tool-cache
|
- Remove obsolete action-rs tool-cache
|
||||||
- Force mdBook to return error codes
|
- Force mdBook to return error codes
|
||||||
|
|
|
@ -97,7 +97,7 @@ pub fn codegen(
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn #name(#context: #name::Context) {
|
fn #name(#context: #name::Context) {
|
||||||
use rtic::Mutex as _;
|
use rtic::Mutex as _;
|
||||||
use rtic::mutex_prelude::*;
|
use rtic::mutex::prelude::*;
|
||||||
|
|
||||||
#(#stmts)*
|
#(#stmts)*
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ pub fn codegen(
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn #name(#context: #name::Context) -> ! {
|
fn #name(#context: #name::Context) -> ! {
|
||||||
use rtic::Mutex as _;
|
use rtic::Mutex as _;
|
||||||
use rtic::mutex_prelude::*;
|
use rtic::mutex::prelude::*;
|
||||||
|
|
||||||
#(#stmts)*
|
#(#stmts)*
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ pub fn codegen(
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn #name(#context: #name::Context #(,#inputs)*) {
|
fn #name(#context: #name::Context #(,#inputs)*) {
|
||||||
use rtic::Mutex as _;
|
use rtic::Mutex as _;
|
||||||
use rtic::mutex_prelude::*;
|
use rtic::mutex::prelude::*;
|
||||||
|
|
||||||
#(#stmts)*
|
#(#stmts)*
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,12 @@ pub use cortex_m_rtic_macros::app;
|
||||||
pub use rtic_core::{prelude as mutex_prelude, Exclusive, Mutex};
|
pub use rtic_core::{prelude as mutex_prelude, Exclusive, Mutex};
|
||||||
pub use rtic_monotonic::{self, Monotonic};
|
pub use rtic_monotonic::{self, Monotonic};
|
||||||
|
|
||||||
|
/// module `mutex::prelude` provides `Mutex` and multi-lock variants. Recommended over `mutex_prelude`
|
||||||
|
pub mod mutex {
|
||||||
|
pub use rtic_core::prelude;
|
||||||
|
pub use rtic_core::Mutex;
|
||||||
|
}
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub mod export;
|
pub mod export;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
|
Loading…
Reference in a new issue