Skip to content
This repository was archived by the owner on Dec 2, 2020. It is now read-only.

Commit 7a961f0

Browse files
Merge #47
47: Clean up doctests to make `cargo test` work r=therealprof a=jonas-schievink Fixes compilation, removes unnecessary `extern crate`s, and adds `no_run` to all doctests to ensure they build without running them. Co-authored-by: Jonas Schievink <[email protected]>
2 parents 19d09ca + 3d5d10a commit 7a961f0

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

src/debug.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
//!
99
//! Target program:
1010
//!
11-
//! ```
12-
//! #[macro_use]
13-
//! extern crate cortex_m_semihosting;
11+
//! ```no_run
1412
//! use cortex_m_semihosting::debug::{self, EXIT_SUCCESS, EXIT_FAILURE};
1513
//!
1614
//! fn main() {

src/lib.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929
//!
3030
//! This example will demonstrate how to print formatted strings.
3131
//!
32-
//! ```rust
33-
//! extern crate cortex_m_semihosting;
34-
//!
32+
//! ```no_run
3533
//! use cortex_m_semihosting::hio;
3634
//! use core::fmt::Write;
3735
//!
@@ -108,8 +106,8 @@
108106
//!
109107
//! Target program:
110108
//!
111-
//! ```
112-
//! extern crate cortex_m_semihosting;
109+
//! ```no_run
110+
//! use cortex_m_semihosting::syscall;
113111
//!
114112
//! // This function will be called by the application
115113
//! fn print() {
@@ -133,17 +131,17 @@
133131
//!
134132
//! Example:
135133
//!
136-
//! ```
134+
//! ```no_run
137135
//! const UUID: *mut u32 = 0x0009_FC70 as *mut u32;
138136
//! dbg!(UUID);
139137
//! let mut uuid: [u32; 4] = [0; 4];
140138
//! for i in 0..4 {
141139
//! dbg!(i);
142-
//! uuid[i] = unsafe { dbg!(UUID.offset(i as isize).read_volatile()) }; }
140+
//! uuid[i] = unsafe { dbg!(UUID.offset(i as isize).read_volatile()) };
143141
//! }
144142
//! ```
145143
//! outputs
146-
//! ```
144+
//! ```text
147145
//! [examples/semihosting.rs:37] UUID = 0x0009fc70
148146
//! [examples/semihosting.rs:40] i = 0
149147
//! [examples/semihosting.rs:41] UUID.offset(i as isize).read_volatile() = 3370045464
@@ -186,8 +184,6 @@
186184
#![deny(warnings)]
187185
#![no_std]
188186

189-
extern crate cortex_m;
190-
191187
#[macro_use]
192188
mod macros;
193189

0 commit comments

Comments
 (0)