Skip to content

Commit 3c8b5ce

Browse files
bors[bot]cbiffle
andcommitted
Merge #273
273: Disable broken doctests so cargo test works. r=ryankurte a=cbiffle Now, `cargo test` still doesn't actually run any tests, but at least it doesn't report a failure. Fixes #271 Co-authored-by: Cliff L. Biffle <code@cliffle.com>
2 parents 1469762 + ff3aff8 commit 3c8b5ce

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

ci/script.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ test_svd() {
2020
}
2121

2222
main() {
23+
# Ensure that `cargo test` works to avoid surprising people, though it
24+
# doesn't help with our actual coverage.
25+
cargo test
26+
2327
if [ $TRAVIS_OS_NAME = windows ]; then
2428
cargo check --target $TARGET
2529
return

src/lib.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//!
1313
//! # Installation
1414
//!
15-
//! ```
15+
//! ```bash
1616
//! $ cargo install svd2rust
1717
//! ```
1818
//!
@@ -109,7 +109,7 @@
109109
//! one of them) and the only way to get an instance of them is through the `Peripherals::take`
110110
//! method.
111111
//!
112-
//! ```
112+
//! ```ignore
113113
//! fn main() {
114114
//! let mut peripherals = stm32f30x::Peripherals::take().unwrap();
115115
//! peripherals.GPIOA.odr.write(|w| w.bits(1));
@@ -119,7 +119,7 @@
119119
//! This method can only be successfully called *once* -- that's why the method returns an `Option`.
120120
//! Subsequent calls to the method will result in a `None` value being returned.
121121
//!
122-
//! ```
122+
//! ```ignore
123123
//! fn main() {
124124
//! let ok = stm32f30x::Peripherals::take().unwrap();
125125
//! let panics = stm32f30x::Peripherals::take().unwrap();
@@ -130,7 +130,7 @@
130130
//! available on all the peripheral types. This method is a useful for implementing safe higher
131131
//! level abstractions.
132132
//!
133-
//! ```
133+
//! ```ignore
134134
//! struct PA0 { _0: () }
135135
//! impl PA0 {
136136
//! fn is_high(&self) -> bool {
@@ -159,7 +159,7 @@
159159
//! memory. Each field in this `struct` represents one register in the register block associated to
160160
//! the peripheral.
161161
//!
162-
//! ```
162+
//! ```ignore
163163
//! /// Inter-integrated circuit
164164
//! pub mod i2c1 {
165165
//! /// Register block
@@ -205,7 +205,7 @@
205205
//!
206206
//! (using `I2C`'s `CR2` register as an example)
207207
//!
208-
//! ``` rust
208+
//! ```ignore
209209
//! impl CR2 {
210210
//! /// Modifies the contents of the register
211211
//! pub fn modify<F>(&self, f: F)
@@ -232,7 +232,7 @@
232232
//! returns a proxy `R` struct that allows access to only the readable bits (i.e. not to the
233233
//! reserved or write-only bits) of the `CR2` register:
234234
//!
235-
//! ``` rust
235+
//! ```ignore
236236
//! /// Value read from the register
237237
//! impl R {
238238
//! /// Bit 0 - Slave address bit 0 (master mode)
@@ -247,7 +247,7 @@
247247
//!
248248
//! Usage looks like this:
249249
//!
250-
//! ``` rust
250+
//! ```ignore
251251
//! // is the SADD0 bit of the CR2 register set?
252252
//! if i2c1.c2r.read().sadd0().bit() {
253253
//! // yes
@@ -264,7 +264,7 @@
264264
//! register after a reset. The rest of `W` methods are "builder-like" and can be used to modify the
265265
//! writable bitfields of the `CR2` register.
266266
//!
267-
//! ``` rust
267+
//! ```ignore
268268
//! impl CR2W {
269269
//! /// Reset value
270270
//! pub fn reset_value() -> Self {
@@ -286,7 +286,7 @@
286286
//!
287287
//! Usage looks like this:
288288
//!
289-
//! ``` rust
289+
//! ```ignore
290290
//! // Starting from the reset value, `0x0000_0000`, change the bitfields SADD0
291291
//! // and SADD1 to `1` and `0b0011110` respectively and write that to the
292292
//! // register CR2.
@@ -309,7 +309,7 @@
309309
//!
310310
//! Usage looks like this:
311311
//!
312-
//! ``` rust
312+
//! ```ignore
313313
//! // Set the START bit to 1 while KEEPING the state of the other bits intact
314314
//! i2c1.cr2.modify(|_, w| unsafe { w.start().bit(true) });
315315
//!
@@ -326,7 +326,7 @@
326326
//!
327327
//! The new `read` API returns an enum that you can match:
328328
//!
329-
//! ```
329+
//! ```ignore
330330
//! match gpioa.dir.read().pin0() {
331331
//! gpioa::dir::PIN0R::Input => { .. },
332332
//! gpioa::dir::PIN0R::Output => { .. },
@@ -335,7 +335,7 @@
335335
//!
336336
//! or test for equality
337337
//!
338-
//! ```
338+
//! ```ignore
339339
//! if gpioa.dir.read().pin0() == gpio::dir::PIN0R::Input {
340340
//! ..
341341
//! }
@@ -344,7 +344,7 @@
344344
//! It also provides convenience methods to check for a specific variant without
345345
//! having to import the enum:
346346
//!
347-
//! ```
347+
//! ```ignore
348348
//! if gpioa.dir.read().pin0().is_input() {
349349
//! ..
350350
//! }
@@ -356,7 +356,7 @@
356356
//!
357357
//! The original `bits` method is available as well:
358358
//!
359-
//! ```
359+
//! ```ignore
360360
//! if gpioa.dir.read().pin0().bits() == 0 {
361361
//! ..
362362
//! }
@@ -365,22 +365,22 @@
365365
//! And the new `write` API provides similar additions as well: `variant` lets you pick the value to
366366
//! write from an `enum`eration of the possible ones:
367367
//!
368-
//! ```
368+
//! ```ignore
369369
//! // enum DIRW { Input, Output }
370370
//! gpioa.dir.write(|w| w.pin0().variant(gpio::dir::PIN0W::Output));
371371
//! ```
372372
//!
373373
//! There are convenience methods to pick one of the variants without having to
374374
//! import the enum:
375375
//!
376-
//! ```
376+
//! ```ignore
377377
//! gpioa.dir.write(|w| w.pin0().output());
378378
//! ```
379379
//!
380380
//! The `bits` (or `bit`) method is still available but will become safe if it's
381381
//! impossible to write a reserved bit pattern into the register:
382382
//!
383-
//! ```
383+
//! ```ignore
384384
//! // safe because there are only two options: `0` or `1`
385385
//! gpioa.dir.write(|w| w.pin0().bit(true));
386386
//! ```
@@ -391,7 +391,7 @@
391391
//! of the device interrupts as an `Interrupt` `enum` in the root of the crate. This `enum` can be
392392
//! used with the `cortex-m` crate `NVIC` API.
393393
//!
394-
//! ```
394+
//! ```ignore
395395
//! extern crate cortex_m;
396396
//! extern crate stm32f30x;
397397
//!

0 commit comments

Comments
 (0)