Skip to content

Commit 33034ee

Browse files
authored
Merge pull request #89 from hyperslv/extern_crate_to_use
Replace unidiomatic 'extern crate' to 'use x as _'
2 parents 3571fc9 + b12af51 commit 33034ee

File tree

9 files changed

+17
-17
lines changed

9 files changed

+17
-17
lines changed

examples/allocator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#![no_std]
1616

1717
extern crate alloc;
18-
extern crate panic_halt;
18+
use panic_halt as _;
1919

2020
use self::alloc::vec;
2121
use core::alloc::Layout;

examples/crash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
#![no_main]
8080
#![no_std]
8181

82-
extern crate panic_halt;
82+
use panic_halt as _;
8383

8484
use core::ptr;
8585

examples/device.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#![no_std]
2727

2828
#[allow(unused_extern_crates)]
29-
extern crate panic_halt;
29+
use panic_halt as _;
3030

3131
use cortex_m::peripheral::syst::SystClkSource;
3232
use cortex_m_rt::entry;

examples/exception.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#![no_main]
1111
#![no_std]
1212

13-
extern crate panic_halt;
13+
use panic_halt as _;
1414

1515
use cortex_m::peripheral::syst::SystClkSource;
1616
use cortex_m::Peripherals;

examples/hello.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#![no_main]
44
#![no_std]
55

6-
extern crate panic_halt;
6+
use panic_halt as _;
77

88
use cortex_m_rt::entry;
99
use cortex_m_semihosting::{debug, hprintln};

examples/itm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#![no_main]
1818
#![no_std]
1919

20-
extern crate panic_halt;
20+
use panic_halt as _;
2121

2222
use cortex_m::{iprintln, Peripherals};
2323
use cortex_m_rt::entry;

examples/panic.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
// Pick one of these panic handlers:
1111

1212
// `panic!` halts execution; the panic message is ignored
13-
extern crate panic_halt;
13+
use panic_halt as _;
1414

1515
// Reports panic messages to the host stderr using semihosting
1616
// NOTE to use this you need to uncomment the `panic-semihosting` dependency in Cargo.toml
17-
// extern crate panic_semihosting;
17+
// use panic_semihosting as _;
1818

1919
// Logs panic messages using the ITM (Instrumentation Trace Macrocell)
2020
// NOTE to use this you need to uncomment the `panic-itm` dependency in Cargo.toml
21-
// extern crate panic_itm;
21+
// use panic_itm as _;
2222

2323
use cortex_m_rt::entry;
2424

examples/test_on_host.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323

2424
// pick a panicking behavior
2525
#[cfg(not(test))]
26-
extern crate panic_halt; // you can put a breakpoint on `rust_begin_unwind` to catch panics
27-
// extern crate panic_abort; // requires nightly
28-
// extern crate panic_itm; // logs messages over ITM; requires ITM support
29-
// extern crate panic_semihosting; // logs messages to the host stderr; requires a debugger
26+
use panic_halt as _; // you can put a breakpoint on `rust_begin_unwind` to catch panics
27+
// use panic_abort as _; // requires nightly
28+
// use panic_itm as _; // logs messages over ITM; requires ITM support
29+
// use panic_semihosting as _; // logs messages to the host stderr; requires a debugger
3030

3131
use cortex_m::asm;
3232
use cortex_m_rt::entry;

src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
#![no_main]
33

44
// pick a panicking behavior
5-
extern crate panic_halt; // you can put a breakpoint on `rust_begin_unwind` to catch panics
6-
// extern crate panic_abort; // requires nightly
7-
// extern crate panic_itm; // logs messages over ITM; requires ITM support
8-
// extern crate panic_semihosting; // logs messages to the host stderr; requires a debugger
5+
use panic_halt as _; // you can put a breakpoint on `rust_begin_unwind` to catch panics
6+
// use panic_abort as _; // requires nightly
7+
// use panic_itm as _; // logs messages over ITM; requires ITM support
8+
// use panic_semihosting as _; // logs messages to the host stderr; requires a debugger
99

1010
use cortex_m::asm;
1111
use cortex_m_rt::entry;

0 commit comments

Comments
 (0)