Skip to content

Commit f5ce983

Browse files
bors[bot]japaric
andcommitted
Merge #115
115: make `iprintln!` not depend on `iprint!` r=therealprof a=japaric 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. r? @rust-embedded/cortex-m (anyone) Co-authored-by: Jorge Aparicio <[email protected]>
2 parents a2da38b + fa1797b commit f5ce983

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- `iprintln!` no longer depends on `iprint!`. `cortex_m::iprintln!` will work
13+
even if `cortex_m::iprint` has not been imported.
14+
1015
## [v0.5.6] - 2018-08-27
1116

1217
### Fixed

src/macros.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ macro_rules! iprint {
1313
#[macro_export]
1414
macro_rules! iprintln {
1515
($channel:expr) => {
16-
iprint!($channel, "\n");
16+
$crate::itm::write_str($channel, "\n");
1717
};
1818
($channel:expr, $fmt:expr) => {
19-
iprint!($channel, concat!($fmt, "\n"));
19+
$crate::itm::write_str($channel, concat!($fmt, "\n"));
2020
};
2121
($channel:expr, $fmt:expr, $($arg:tt)*) => {
22-
iprint!($channel, concat!($fmt, "\n"), $($arg)*);
22+
$crate::itm::write_fmt($channel, format_args!(concat!($fmt, "\n"), $($arg)*));
2323
};
2424
}
2525

0 commit comments

Comments
 (0)