Skip to content

Commit 7375e5e

Browse files
committed
Migrate to the 2018 edition
No need for `extern crate` imports!
1 parent e9a92d7 commit 7375e5e

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

crate/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ name = "rust-webpack"
77
readme = "./README.md"
88
repository = "https://github.com/rustwasm/rust-webpack-template"
99
version = "0.1.0"
10+
edition = "2018"
1011

1112
[lib]
1213
crate-type = ["cdylib"]

crate/src/lib.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
1-
#[macro_use]
2-
extern crate cfg_if;
3-
extern crate web_sys;
4-
extern crate wasm_bindgen;
5-
61
use wasm_bindgen::prelude::*;
72

8-
cfg_if! {
3+
cfg_if::cfg_if! {
94
// When the `console_error_panic_hook` feature is enabled, we can call the
105
// `set_panic_hook` function to get better error messages if we ever panic.
116
if #[cfg(feature = "console_error_panic_hook")] {
12-
extern crate console_error_panic_hook;
137
use console_error_panic_hook::set_once as set_panic_hook;
148
} else {
159
#[inline]
1610
fn set_panic_hook() {}
1711
}
1812
}
1913

20-
cfg_if! {
14+
cfg_if::cfg_if! {
2115
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
2216
// allocator.
2317
if #[cfg(feature = "wee_alloc")] {
24-
extern crate wee_alloc;
2518
#[global_allocator]
2619
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
2720
}

0 commit comments

Comments
 (0)