diff options
author | 2018-09-06 20:44:33 +0200 | |
---|---|---|
committer | 2018-09-06 20:44:33 +0200 | |
commit | fa1797b21c93c85b453fb90b0060a2cdf6137cb9 (patch) | |
tree | 31e1da4b405da85f6c51a6d1581b486c0c6f5d5e | |
parent | a2da38b0dced156c6fa78fb71d1fea2acb908c4d (diff) | |
download | cortex-m-fa1797b21c93c85b453fb90b0060a2cdf6137cb9.tar.gz cortex-m-fa1797b21c93c85b453fb90b0060a2cdf6137cb9.tar.zst cortex-m-fa1797b21c93c85b453fb90b0060a2cdf6137cb9.zip |
make `iprintln!` not depend on `iprint!`
the preferred way to import macros in Rust 2018 is via `use`. If you import
`iprintln` and try to use you'll get an error if the `iprint` macro has not been
imported as well.
This commit makes `iprintln` work w/o having to import `iprint` as well.
-rw-r--r-- | CHANGELOG.md | 5 | ||||
-rw-r--r-- | src/macros.rs | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index b4815fe..76bd264 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Changed + +- `iprintln!` no longer depends on `iprint!`. `cortex_m::iprintln!` will work + even if `cortex_m::iprint` has not been imported. + ## [v0.5.6] - 2018-08-27 ### Fixed diff --git a/src/macros.rs b/src/macros.rs index e41cdc5..813552f 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -13,13 +13,13 @@ macro_rules! iprint { #[macro_export] macro_rules! iprintln { ($channel:expr) => { - iprint!($channel, "\n"); + $crate::itm::write_str($channel, "\n"); }; ($channel:expr, $fmt:expr) => { - iprint!($channel, concat!($fmt, "\n")); + $crate::itm::write_str($channel, concat!($fmt, "\n")); }; ($channel:expr, $fmt:expr, $($arg:tt)*) => { - iprint!($channel, concat!($fmt, "\n"), $($arg)*); + $crate::itm::write_fmt($channel, format_args!(concat!($fmt, "\n"), $($arg)*)); }; } |