mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-28 12:11:34 +00:00
Migrate all crates to the 2018 edition
Most of the CLI crates were already in the 2018 edition, and it turns out that one of the macro crates was already in the 2018 edition so we may as well move everything to the 2018 edition! Always nice to remove those `extern crate` statements nowadays! This commit also does a `cargo fmt --all` to make sure we're conforming with style again.
This commit is contained in:
@ -4,7 +4,7 @@ use std::ptr;
|
||||
use std::alloc::{self, Layout};
|
||||
use std::mem;
|
||||
|
||||
use JsValue;
|
||||
use crate::JsValue;
|
||||
|
||||
externs! {
|
||||
#[link(wasm_import_module = "__wbindgen_anyref_xform__")]
|
||||
|
@ -1,4 +1,4 @@
|
||||
use JsValue;
|
||||
use crate::JsValue;
|
||||
|
||||
/// A trait for checked and unchecked casting between JS types.
|
||||
///
|
||||
|
@ -9,11 +9,11 @@ use std::marker::Unsize;
|
||||
use std::mem::{self, ManuallyDrop};
|
||||
use std::prelude::v1::*;
|
||||
|
||||
use convert::*;
|
||||
use describe::*;
|
||||
use throw_str;
|
||||
use JsValue;
|
||||
use UnwrapThrowExt;
|
||||
use crate::convert::*;
|
||||
use crate::describe::*;
|
||||
use crate::throw_str;
|
||||
use crate::JsValue;
|
||||
use crate::UnwrapThrowExt;
|
||||
|
||||
/// A handle to both a closure in Rust as well as JS closure which will invoke
|
||||
/// the Rust closure.
|
||||
@ -642,7 +642,7 @@ macro_rules! doit {
|
||||
|
||||
fn into_js_function(self) -> JsValue {
|
||||
use std::rc::Rc;
|
||||
use __rt::WasmRefCell;
|
||||
use crate::__rt::WasmRefCell;
|
||||
|
||||
let mut me = Some(self);
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
use core::mem;
|
||||
|
||||
use convert::slices::WasmSlice;
|
||||
use convert::{FromWasmAbi, GlobalStack, IntoWasmAbi, ReturnWasmAbi, Stack};
|
||||
use describe::{inform, WasmDescribe, FUNCTION};
|
||||
use throw_str;
|
||||
use crate::convert::slices::WasmSlice;
|
||||
use crate::convert::{FromWasmAbi, GlobalStack, IntoWasmAbi, ReturnWasmAbi, Stack};
|
||||
use crate::describe::{inform, WasmDescribe, FUNCTION};
|
||||
use crate::throw_str;
|
||||
|
||||
macro_rules! stack_closures {
|
||||
($( ($cnt:tt $invoke:ident $invoke_mut:ident $($var:ident)*) )*) => ($(
|
||||
|
@ -1,10 +1,10 @@
|
||||
use core::char;
|
||||
use core::mem::{self, ManuallyDrop};
|
||||
|
||||
use convert::traits::WasmAbi;
|
||||
use convert::{FromWasmAbi, IntoWasmAbi, RefFromWasmAbi, Stack};
|
||||
use convert::{OptionFromWasmAbi, OptionIntoWasmAbi, ReturnWasmAbi};
|
||||
use {Clamped, JsValue};
|
||||
use crate::convert::traits::WasmAbi;
|
||||
use crate::convert::{FromWasmAbi, IntoWasmAbi, RefFromWasmAbi, Stack};
|
||||
use crate::convert::{OptionFromWasmAbi, OptionIntoWasmAbi, ReturnWasmAbi};
|
||||
use crate::{Clamped, JsValue};
|
||||
|
||||
unsafe impl WasmAbi for () {}
|
||||
|
||||
@ -414,7 +414,7 @@ impl<T: IntoWasmAbi> ReturnWasmAbi for Result<T, JsValue> {
|
||||
fn return_abi(self, extra: &mut Stack) -> Self::Abi {
|
||||
match self {
|
||||
Ok(v) => v.into_abi(extra),
|
||||
Err(e) => ::throw_val(e),
|
||||
Err(e) => crate::throw_val(e),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ impl GlobalStack {
|
||||
impl Stack for GlobalStack {
|
||||
#[inline]
|
||||
fn push(&mut self, val: u32) {
|
||||
use __rt::{__wbindgen_global_argument_ptr as global_ptr, GLOBAL_STACK_CAP};
|
||||
use crate::__rt::{__wbindgen_global_argument_ptr as global_ptr, GLOBAL_STACK_CAP};
|
||||
unsafe {
|
||||
assert!(self.next < GLOBAL_STACK_CAP);
|
||||
*global_ptr().offset(self.next as isize) = val;
|
||||
|
@ -4,12 +4,12 @@ use std::prelude::v1::*;
|
||||
use core::slice;
|
||||
use core::str;
|
||||
|
||||
use convert::{FromWasmAbi, IntoWasmAbi, RefFromWasmAbi, RefMutFromWasmAbi, WasmAbi};
|
||||
use convert::{OptionIntoWasmAbi, Stack};
|
||||
use crate::convert::{FromWasmAbi, IntoWasmAbi, RefFromWasmAbi, RefMutFromWasmAbi, WasmAbi};
|
||||
use crate::convert::{OptionIntoWasmAbi, Stack};
|
||||
|
||||
if_std! {
|
||||
use core::mem;
|
||||
use convert::OptionFromWasmAbi;
|
||||
use crate::convert::OptionFromWasmAbi;
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
@ -204,7 +204,7 @@ impl RefFromWasmAbi for str {
|
||||
}
|
||||
|
||||
if_std! {
|
||||
use JsValue;
|
||||
use crate::JsValue;
|
||||
|
||||
impl IntoWasmAbi for Box<[JsValue]> {
|
||||
type Abi = WasmSlice;
|
||||
|
@ -1,6 +1,6 @@
|
||||
use core::ops::{Deref, DerefMut};
|
||||
|
||||
use describe::*;
|
||||
use crate::describe::*;
|
||||
|
||||
/// A trait for anything that can be converted into a type that can cross the
|
||||
/// wasm ABI directly, eg `u32` or `f64`.
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#![doc(hidden)]
|
||||
|
||||
use {Clamped, JsValue};
|
||||
use crate::{Clamped, JsValue};
|
||||
|
||||
macro_rules! tys {
|
||||
($($a:ident)*) => (tys! { @ ($($a)*) 0 });
|
||||
|
19
src/lib.rs
19
src/lib.rs
@ -9,20 +9,13 @@
|
||||
#![doc(html_root_url = "https://docs.rs/wasm-bindgen/0.2")]
|
||||
#![cfg_attr(feature = "nightly", feature(unsize))]
|
||||
|
||||
#[cfg(feature = "serde-serialize")]
|
||||
extern crate serde;
|
||||
#[cfg(feature = "serde-serialize")]
|
||||
extern crate serde_json;
|
||||
|
||||
extern crate wasm_bindgen_macro;
|
||||
|
||||
use core::fmt;
|
||||
use core::marker;
|
||||
use core::mem;
|
||||
use core::ops::{Deref, DerefMut};
|
||||
use core::ptr;
|
||||
|
||||
use convert::FromWasmAbi;
|
||||
use crate::convert::FromWasmAbi;
|
||||
|
||||
macro_rules! if_std {
|
||||
($($i:item)*) => ($(
|
||||
@ -54,14 +47,14 @@ macro_rules! externs {
|
||||
/// use wasm_bindgen::prelude::*;
|
||||
/// ```
|
||||
pub mod prelude {
|
||||
pub use crate::JsValue;
|
||||
pub use crate::UnwrapThrowExt;
|
||||
#[doc(hidden)]
|
||||
pub use wasm_bindgen_macro::__wasm_bindgen_class_marker;
|
||||
pub use wasm_bindgen_macro::wasm_bindgen;
|
||||
pub use JsValue;
|
||||
pub use UnwrapThrowExt;
|
||||
|
||||
if_std! {
|
||||
pub use closure::Closure;
|
||||
pub use crate::closure::Closure;
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,7 +62,7 @@ pub mod convert;
|
||||
pub mod describe;
|
||||
|
||||
mod cast;
|
||||
pub use cast::JsCast;
|
||||
pub use crate::cast::JsCast;
|
||||
|
||||
if_std! {
|
||||
extern crate std;
|
||||
@ -1002,7 +995,7 @@ pub mod __rt {
|
||||
///
|
||||
/// Ideas for how to improve this are most welcome!
|
||||
pub fn link_mem_intrinsics() {
|
||||
::anyref::link_intrinsics();
|
||||
crate::anyref::link_intrinsics();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user