Skip to content

Commit fa0c4ad

Browse files
bors[bot]JOE1994
andauthored
Merge #438
438: Remove unnecessary coercions to 'String' + small fixes to doc comments r=therealprof a=JOE1994 Remove unnecessary coercions to 'String' + small fixes to doc comments ------------------------------------- Thank you for reviewing this PR 😸 Co-authored-by: JOE1994 <joseph942010@gmail.com>
2 parents f7576a9 + 1b79c55 commit fa0c4ad

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
//! [CMSIS-SVD]: http://www.keil.com/pack/doc/CMSIS/SVD/html/index.html
44
//!
55
//! A SVD file is an XML file that describes the hardware features of a
6-
//! microcontroller. In particular, it list all the peripherals available to the
7-
//! device, where the registers associated to each device are located in memory
6+
//! microcontroller. In particular, it lists all the peripherals available to the
7+
//! device, where the registers associated to each device are located in memory,
88
//! and what's the function of each register.
99
//!
1010
//! `svd2rust` is a command line tool that transforms SVD files into crates that
@@ -28,7 +28,7 @@
2828
//!
2929
//! ## target = cortex-m
3030
//!
31-
//! When targeting the Cortex-M architecture `svd2rust` will generate three files in the current
31+
//! When targeting the Cortex-M architecture, `svd2rust` will generate three files in the current
3232
//! directory:
3333
//!
3434
//! - `build.rs`, build script that places `device.x` somewhere the linker can find.
@@ -174,7 +174,7 @@
174174
//! ```
175175
//!
176176
//! The singleton property can be *unsafely* bypassed using the `ptr` static method which is
177-
//! available on all the peripheral types. This method is a useful for implementing safe higher
177+
//! available on all the peripheral types. This method is useful for implementing safe higher
178178
//! level abstractions.
179179
//!
180180
//! ```ignore
@@ -240,15 +240,15 @@
240240
//! # `read` / `modify` / `write` API
241241
//!
242242
//! Each register in the register block, e.g. the `cr1` field in the `I2C` struct, exposes a
243-
//! combination of the `read`, `modify` and `write` methods. Which methods exposes each register
243+
//! combination of the `read`, `modify`, and `write` methods. Which method exposes each register
244244
//! depends on whether the register is read-only, read-write or write-only:
245245
//!
246246
//! - read-only registers only expose the `read` method.
247247
//! - write-only registers only expose the `write` method.
248-
//! - read-write registers expose all the methods: `read`, `modify` and
248+
//! - read-write registers expose all the methods: `read`, `modify`, and
249249
//! `write`.
250250
//!
251-
//! This is signature of each of these methods:
251+
//! Below shows signatures of each of these methods:
252252
//!
253253
//! (using `I2C`'s `CR2` register as an example)
254254
//!
@@ -467,7 +467,7 @@
467467
//!
468468
//! ## the "rt" feature
469469
//!
470-
//! If the "rt" Cargo feature of the svd2rust generated crate is enabled the crate will populate the
470+
//! If the "rt" Cargo feature of the svd2rust generated crate is enabled, the crate will populate the
471471
//! part of the vector table that contains the interrupt vectors and provide an
472472
//! [`interrupt!`](macro.interrupt.html) macro (non Cortex-M/MSP430 targets) or [`interrupt`] attribute
473473
//! (Cortex-M or [MSP430](https://docs.rs/msp430-rt-macros/0.1/msp430_rt_macros/attr.interrupt.html))

src/util.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,19 +165,19 @@ pub fn escape_brackets(s: &str) -> String {
165165
if acc == "" {
166166
x.to_string()
167167
} else if acc.ends_with('\\') {
168-
acc + "[" + &x.to_string()
168+
acc + "[" + x
169169
} else {
170-
acc + "\\[" + &x.to_string()
170+
acc + "\\[" + x
171171
}
172172
})
173173
.split(']')
174174
.fold("".to_string(), |acc, x| {
175175
if acc == "" {
176176
x.to_string()
177177
} else if acc.ends_with('\\') {
178-
acc + "]" + &x.to_string()
178+
acc + "]" + x
179179
} else {
180-
acc + "\\]" + &x.to_string()
180+
acc + "\\]" + x
181181
}
182182
})
183183
}

0 commit comments

Comments
 (0)