Skip to content

Commit

Permalink
Merge pull request #89 from hyperslv/extern_crate_to_use
Browse files Browse the repository at this point in the history
Replace unidiomatic 'extern crate' to 'use x as _'
  • Loading branch information
adamgreig authored Jun 14, 2020
2 parents 3571fc9 + b12af51 commit 33034ee
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion examples/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#![no_std]

extern crate alloc;
extern crate panic_halt;
use panic_halt as _;

use self::alloc::vec;
use core::alloc::Layout;
Expand Down
2 changes: 1 addition & 1 deletion examples/crash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
#![no_main]
#![no_std]

extern crate panic_halt;
use panic_halt as _;

use core::ptr;

Expand Down
2 changes: 1 addition & 1 deletion examples/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#![no_std]

#[allow(unused_extern_crates)]
extern crate panic_halt;
use panic_halt as _;

use cortex_m::peripheral::syst::SystClkSource;
use cortex_m_rt::entry;
Expand Down
2 changes: 1 addition & 1 deletion examples/exception.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#![no_main]
#![no_std]

extern crate panic_halt;
use panic_halt as _;

use cortex_m::peripheral::syst::SystClkSource;
use cortex_m::Peripherals;
Expand Down
2 changes: 1 addition & 1 deletion examples/hello.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![no_main]
#![no_std]

extern crate panic_halt;
use panic_halt as _;

use cortex_m_rt::entry;
use cortex_m_semihosting::{debug, hprintln};
Expand Down
2 changes: 1 addition & 1 deletion examples/itm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#![no_main]
#![no_std]

extern crate panic_halt;
use panic_halt as _;

use cortex_m::{iprintln, Peripherals};
use cortex_m_rt::entry;
Expand Down
6 changes: 3 additions & 3 deletions examples/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
// Pick one of these panic handlers:

// `panic!` halts execution; the panic message is ignored
extern crate panic_halt;
use panic_halt as _;

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

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

use cortex_m_rt::entry;

Expand Down
8 changes: 4 additions & 4 deletions examples/test_on_host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

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

use cortex_m::asm;
use cortex_m_rt::entry;
Expand Down
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
#![no_main]

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

use cortex_m::asm;
use cortex_m_rt::entry;
Expand Down

0 comments on commit 33034ee

Please sign in to comment.