Skip to content

Commit

Permalink
Merge #340
Browse files Browse the repository at this point in the history
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 <narukara17@gmail.com>
  • Loading branch information
bors[bot] and Narukara authored Jan 18, 2023
2 parents 19f798d + f200f79 commit c7e7903
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
9 changes: 4 additions & 5 deletions src/collections/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ in your program instead of this allocator.
``` rust,ignore
// Bump pointer allocator implementation
extern crate cortex_m;
use core::alloc::GlobalAlloc;
use core::alloc::{GlobalAlloc, Layout};
use core::cell::UnsafeCell;
use core::ptr;
use cortex_m::interrupt;
Expand Down Expand Up @@ -144,8 +143,7 @@ as they are exact same implementation.
allocator. Just `use` its collections and proceed to instantiate them:

```rust,ignore
extern crate heapless; // v0.4.x
// heapless version: v0.4.x
use heapless::Vec;
use heapless::consts::*;
Expand All @@ -155,6 +153,7 @@ fn main() -> ! {
xs.push(42).unwrap();
assert_eq!(xs.pop(), Some(42));
loop {}
}
```

Expand Down
2 changes: 0 additions & 2 deletions src/interoperability/c-with-rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ For projects with limited dependencies or complexity, or for projects where it i
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:

```rust,ignore
extern crate cc;
fn main() {
cc::Build::new()
.file("foo.c")
Expand Down
3 changes: 1 addition & 2 deletions src/peripherals/singletons.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ This has a small runtime overhead because we must wrap the `SerialPort` structur
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.

```rust,ignore
#[macro_use(singleton)]
extern crate cortex_m;
use cortex_m::singleton;
fn main() {
// OK if `main` is executed only once
Expand Down

0 comments on commit c7e7903

Please sign in to comment.