Skip to content

Commit c7e7903

Browse files
bors[bot]Narukara
andauthored
Merge #340
340: remove extern crate statements r=eldruin a=Narukara from issue #41 I kept this one because `alloc` can only be imported that way: https://github.com/rust-embedded/book/blob/19f798d448835a4888e3b3eae7fe69f1d61d8681/src/collections/index.md?plain=1#L33 Closes #41 Co-authored-by: Narukara <[email protected]>
2 parents 19f798d + f200f79 commit c7e7903

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

src/collections/index.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ in your program instead of this allocator.
4949
``` rust,ignore
5050
// Bump pointer allocator implementation
5151
52-
extern crate cortex_m;
53-
54-
use core::alloc::GlobalAlloc;
52+
use core::alloc::{GlobalAlloc, Layout};
53+
use core::cell::UnsafeCell;
5554
use core::ptr;
5655
5756
use cortex_m::interrupt;
@@ -144,8 +143,7 @@ as they are exact same implementation.
144143
allocator. Just `use` its collections and proceed to instantiate them:
145144

146145
```rust,ignore
147-
extern crate heapless; // v0.4.x
148-
146+
// heapless version: v0.4.x
149147
use heapless::Vec;
150148
use heapless::consts::*;
151149
@@ -155,6 +153,7 @@ fn main() -> ! {
155153
156154
xs.push(42).unwrap();
157155
assert_eq!(xs.pop(), Some(42));
156+
loop {}
158157
}
159158
```
160159

src/interoperability/c-with-rust.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ For projects with limited dependencies or complexity, or for projects where it i
125125
In the simplest case of compiling a single C file as a dependency to a static library, an example `build.rs` script using the [`cc` crate] would look like this:
126126

127127
```rust,ignore
128-
extern crate cc;
129-
130128
fn main() {
131129
cc::Build::new()
132130
.file("foo.c")

src/peripherals/singletons.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ This has a small runtime overhead because we must wrap the `SerialPort` structur
6161
Although we created our own `Peripherals` structure above, it is not necessary to do this for your code. the `cortex_m` crate contains a macro called `singleton!()` that will perform this action for you.
6262

6363
```rust,ignore
64-
#[macro_use(singleton)]
65-
extern crate cortex_m;
64+
use cortex_m::singleton;
6665
6766
fn main() {
6867
// OK if `main` is executed only once

0 commit comments

Comments
 (0)