Skip to content

Replace unidiomatic 'extern crate' to 'use x as _' #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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