Skip to content

Commit 4a263a9

Browse files
Merge #328
328: Prevent quoted doc strings from generating extra blanks at the beginning r=adamgreig a=therealprof Using `/// something` in a quote! block generates `#[doc = r" something"]` need to use `///something` to get the more appropriate `#[doc = r"something"]` instead Signed-off-by: Daniel Egger <[email protected]> Co-authored-by: Daniel Egger <[email protected]>
2 parents c1b6f3e + ee00421 commit 4a263a9

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

src/generate/device.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub fn render(
9090
let bits = util::unsuffixed(u64::from(cpu.nvic_priority_bits));
9191

9292
out.push(quote! {
93-
/// Number available in the NVIC for configuring priority
93+
///Number available in the NVIC for configuring priority
9494
pub const NVIC_PRIO_BITS: u8 = #bits;
9595
});
9696

@@ -173,7 +173,7 @@ pub fn render(
173173
}
174174
.map(|krate| {
175175
quote! {
176-
/// Returns all the peripherals *once*
176+
///Returns all the peripherals *once*
177177
#[inline]
178178
pub fn take() -> Option<Self> {
179179
#krate::interrupt::free(|_| {
@@ -194,7 +194,7 @@ pub fn render(
194194
#[no_mangle]
195195
static mut DEVICE_PERIPHERALS: bool = false;
196196

197-
/// All the peripherals
197+
///All the peripherals
198198
#[allow(non_snake_case)]
199199
pub struct Peripherals {
200200
#(#fields,)*
@@ -203,7 +203,7 @@ pub fn render(
203203
impl Peripherals {
204204
#take
205205

206-
/// Unchecked version of `Peripherals::take`
206+
///Unchecked version of `Peripherals::take`
207207
pub unsafe fn steal() -> Self {
208208
DEVICE_PERIPHERALS = true;
209209

src/generate/interrupt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ pub fn render(
153153
}
154154

155155
let interrupt_enum = quote! {
156-
/// Enumeration of all the interrupts
156+
///Enumeration of all the interrupts
157157
#[derive(Copy, Clone, Debug)]
158158
pub enum Interrupt {
159159
#(#variants)*

src/generate/peripheral.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub fn render(
5353
unsafe impl Send for #name_pc {}
5454

5555
impl #name_pc {
56-
/// Returns a pointer to the register block
56+
///Returns a pointer to the register block
5757
#[inline(always)]
5858
pub const fn ptr() -> *const #base::RegisterBlock {
5959
#address as *const _
@@ -540,7 +540,7 @@ fn register_or_cluster_block(
540540
};
541541

542542
Ok(quote! {
543-
/// Register block
543+
///Register block
544544
#[repr(C)]
545545
pub struct #name {
546546
#fields
@@ -747,7 +747,7 @@ fn cluster_block(
747747
Ok(quote! {
748748
#reg_block
749749

750-
/// Register block
750+
///Register block
751751
#[doc = #description]
752752
pub mod #name_sc {
753753
#(#mod_items)*

src/generate/register.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn render(
4444

4545
if access == Access::ReadWrite || access == Access::ReadWriteOnce {
4646
reg_impl_items.push(quote! {
47-
/// Modifies the contents of the register
47+
///Modifies the contents of the register
4848
#[inline(always)]
4949
pub fn modify<F>(&self, f: F)
5050
where
@@ -58,22 +58,22 @@ pub fn render(
5858

5959
if can_read {
6060
reg_impl_items.push(quote! {
61-
/// Reads the contents of the register
61+
///Reads the contents of the register
6262
#[inline(always)]
6363
pub fn read(&self) -> R {
6464
R { bits: self.register.get() }
6565
}
6666
});
6767

6868
mod_items.push(quote! {
69-
/// Value read from the register
69+
///Value read from the register
7070
pub struct R {
7171
bits: #rty,
7272
}
7373
});
7474

7575
r_impl_items.push(quote! {
76-
/// Value of the register as raw bits
76+
///Value of the register as raw bits
7777
#[inline(always)]
7878
pub fn bits(&self) -> #rty {
7979
self.bits
@@ -83,7 +83,7 @@ pub fn render(
8383

8484
if can_write {
8585
reg_impl_items.push(quote! {
86-
/// Writes to the register
86+
///Writes to the register
8787
#[inline(always)]
8888
pub fn write<F>(&self, f: F)
8989
where
@@ -94,7 +94,7 @@ pub fn render(
9494
});
9595

9696
mod_items.push(quote! {
97-
/// Value to write to the register
97+
///Value to write to the register
9898
pub struct W {
9999
bits: #rty,
100100
}
@@ -107,20 +107,20 @@ pub fn render(
107107
.ok_or_else(|| format!("Register {} has no reset value", register.name))?;
108108

109109
reg_impl_items.push(quote! {
110-
/// Reset value of the register
110+
///Reset value of the register
111111
#[inline(always)]
112112
pub const fn reset_value() -> #rty {
113113
#rv
114114
}
115-
/// Writes the reset value to the register
115+
///Writes the reset value to the register
116116
#[inline(always)]
117117
pub fn reset(&self) {
118118
self.register.set(Self::reset_value())
119119
}
120120
});
121121

122122
w_impl_items.push(quote! {
123-
/// Writes raw bits to the register
123+
///Writes raw bits to the register
124124
#[inline(always)]
125125
pub #unsafety fn bits(&mut self, bits: #rty) -> &mut Self {
126126
self.bits = bits;
@@ -390,7 +390,7 @@ pub fn fields(
390390
.collect::<Vec<_>>();
391391
if has_reserved_variant {
392392
vars.push(quote! {
393-
/// Reserved
393+
///Reserved
394394
_Reserved(#fty)
395395
});
396396
}
@@ -423,13 +423,13 @@ pub fn fields(
423423

424424
if f.width == 1 {
425425
enum_items.push(quote! {
426-
/// Returns `true` if the bit is clear (0)
426+
///Returns `true` if the bit is clear (0)
427427
#[inline(always)]
428428
pub fn bit_is_clear(&self) -> bool {
429429
!self.#bits()
430430
}
431431

432-
/// Returns `true` if the bit is set (1)
432+
///Returns `true` if the bit is set (1)
433433
#[inline(always)]
434434
pub fn bit_is_set(&self) -> bool {
435435
self.#bits()
@@ -438,7 +438,7 @@ pub fn fields(
438438
}
439439

440440
enum_items.push(quote! {
441-
/// Value of the field as raw bits
441+
///Value of the field as raw bits
442442
#[inline(always)]
443443
pub fn #bits(&self) -> #fty {
444444
match *self {
@@ -521,7 +521,7 @@ pub fn fields(
521521

522522
let mut pc_r_impl_items = vec![
523523
quote! {
524-
/// Value of the field as raw bits
524+
///Value of the field as raw bits
525525
#[inline(always)]
526526
pub fn #bits(&self) -> #fty {
527527
self.bits
@@ -531,13 +531,13 @@ pub fn fields(
531531

532532
if f.width == 1 {
533533
pc_r_impl_items.push(quote! {
534-
/// Returns `true` if the bit is clear (0)
534+
///Returns `true` if the bit is clear (0)
535535
#[inline(always)]
536536
pub fn bit_is_clear(&self) -> bool {
537537
!self.#bits()
538538
}
539539

540-
/// Returns `true` if the bit is set (1)
540+
///Returns `true` if the bit is set (1)
541541
#[inline(always)]
542542
pub fn bit_is_set(&self) -> bool {
543543
self.#bits()
@@ -546,7 +546,7 @@ pub fn fields(
546546
}
547547

548548
mod_items.push(quote! {
549-
/// Value of the field
549+
///Value of the field
550550
pub struct #pc_r {
551551
bits: #fty,
552552
}
@@ -704,7 +704,7 @@ pub fn fields(
704704
}
705705

706706
proxy_items.push(quote! {
707-
/// Writes `variant` to the field
707+
///Writes `variant` to the field
708708
#[inline(always)]
709709
pub fn variant(self, variant: #pc_w) -> &'a mut W {
710710
#unsafety {
@@ -740,20 +740,20 @@ pub fn fields(
740740

741741
if width == 1 {
742742
proxy_items.push(quote! {
743-
/// Sets the field bit
743+
///Sets the field bit
744744
pub #unsafety fn set_bit(self) -> &'a mut W {
745745
self.bit(true)
746746
}
747747

748-
/// Clears the field bit
748+
///Clears the field bit
749749
pub #unsafety fn clear_bit(self) -> &'a mut W {
750750
self.bit(false)
751751
}
752752
});
753753
}
754754

755755
proxy_items.push(quote! {
756-
/// Writes raw bits to the field
756+
///Writes raw bits to the field
757757
#[inline(always)]
758758
pub #unsafety fn #bits(self, value: #fty) -> &'a mut W {
759759
self.w.bits &= !(#mask << #offset);
@@ -764,7 +764,7 @@ pub fn fields(
764764

765765
let _pc_w = &f._pc_w;
766766
mod_items.push(quote! {
767-
/// Proxy
767+
///Proxy
768768
pub struct #_pc_w<'a> {
769769
w: &'a mut W,
770770
}

0 commit comments

Comments
 (0)