From 1d0c333a2b017f00b4168cdffbc29fae871728ee Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 12 Aug 2019 11:28:37 -0700 Subject: [PATCH] Run `cargo fmt` over all code --- crates/cli-support/src/js/outgoing.rs | 5 ++++- crates/cli-support/src/lib.rs | 3 ++- crates/cli-support/src/webidl/mod.rs | 20 +++++++------------- crates/futures/src/legacy_shared.rs | 6 +++--- examples/closures/src/lib.rs | 2 +- examples/raytrace-parallel/src/lib.rs | 3 ++- src/convert/slices.rs | 4 +--- src/describe.rs | 2 +- src/lib.rs | 1 - 9 files changed, 21 insertions(+), 25 deletions(-) diff --git a/crates/cli-support/src/js/outgoing.rs b/crates/cli-support/src/js/outgoing.rs index c8b74c34..7ec175a6 100644 --- a/crates/cli-support/src/js/outgoing.rs +++ b/crates/cli-support/src/js/outgoing.rs @@ -148,7 +148,10 @@ impl<'a, 'b> Outgoing<'a, 'b> { self.cx.expose_get_cached_string_from_wasm()?; - self.js.prelude(&format!("const v{} = getCachedStringFromWasm({}, {});", tmp, ptr, len)); + self.js.prelude(&format!( + "const v{} = getCachedStringFromWasm({}, {});", + tmp, ptr, len + )); if *owned { self.prelude_free_cached_string(&ptr, &len)?; diff --git a/crates/cli-support/src/lib.rs b/crates/cli-support/src/lib.rs index dba02d63..114d93fa 100755 --- a/crates/cli-support/src/lib.rs +++ b/crates/cli-support/src/lib.rs @@ -287,7 +287,8 @@ impl Bindgen { ); } - self.threads.run(&mut module) + self.threads + .run(&mut module) .with_context(|_| "failed to prepare module for threading")?; // If requested, turn all mangled symbols into prettier unmangled diff --git a/crates/cli-support/src/webidl/mod.rs b/crates/cli-support/src/webidl/mod.rs index d6500637..62fe7c81 100644 --- a/crates/cli-support/src/webidl/mod.rs +++ b/crates/cli-support/src/webidl/mod.rs @@ -627,14 +627,10 @@ impl<'a> Context<'a> { // Make sure to export the `anyref` table for the JS bindings since it // will need to be initialized. If it doesn't exist though then the // module must not use it, so we skip it. - let table = self - .module - .tables - .iter() - .find(|t| match t.kind { - walrus::TableKind::Anyref(_) => true, - _ => false, - }); + let table = self.module.tables.iter().find(|t| match t.kind { + walrus::TableKind::Anyref(_) => true, + _ => false, + }); let table = match table { Some(t) => t.id(), None => return Ok(()), @@ -642,11 +638,9 @@ impl<'a> Context<'a> { self.module.exports.add("__wbg_anyref_table", table); let ty = self.module.types.add(&[], &[]); - let (import, import_id) = self.module.add_import_func( - PLACEHOLDER_MODULE, - "__wbindgen_init_anyref_table", - ty, - ); + let (import, import_id) = + self.module + .add_import_func(PLACEHOLDER_MODULE, "__wbindgen_init_anyref_table", ty); self.module.start = Some(match self.module.start { Some(prev_start) => { diff --git a/crates/futures/src/legacy_shared.rs b/crates/futures/src/legacy_shared.rs index a53e32e1..8b943455 100644 --- a/crates/futures/src/legacy_shared.rs +++ b/crates/futures/src/legacy_shared.rs @@ -1,10 +1,10 @@ -use std::cell::RefCell; use futures::future; -use std::fmt; -use std::rc::Rc; use futures::prelude::*; use futures::sync::oneshot; use js_sys::Promise; +use std::cell::RefCell; +use std::fmt; +use std::rc::Rc; use wasm_bindgen::prelude::*; /// A Rust `Future` backed by a JavaScript `Promise`. diff --git a/examples/closures/src/lib.rs b/examples/closures/src/lib.rs index 541aacbe..fd9ebc2e 100644 --- a/examples/closures/src/lib.rs +++ b/examples/closures/src/lib.rs @@ -106,7 +106,7 @@ fn setup_clicker(document: &Document) { .dyn_ref::() .expect("#green-square be an `HtmlElement`") .set_onclick(Some(a.as_ref().unchecked_ref())); - + // See comments in `setup_clock` above for why we use `a.forget()`. a.forget(); } diff --git a/examples/raytrace-parallel/src/lib.rs b/examples/raytrace-parallel/src/lib.rs index cfc05d61..413dbed5 100644 --- a/examples/raytrace-parallel/src/lib.rs +++ b/examples/raytrace-parallel/src/lib.rs @@ -90,7 +90,8 @@ impl Scene { }); drop(tx.send(rgb_data)); })?; - let done = rx.map(move |_data| image_data(base, len, width, height).into()) + let done = rx + .map(move |_data| image_data(base, len, width, height).into()) .map_err(|_| JsValue::undefined()); Ok(RenderingScene { diff --git a/src/convert/slices.rs b/src/convert/slices.rs index f7af9af9..4bea871b 100644 --- a/src/convert/slices.rs +++ b/src/convert/slices.rs @@ -4,9 +4,9 @@ use std::prelude::v1::*; use core::slice; use core::str; -use cfg_if::cfg_if; use crate::convert::OptionIntoWasmAbi; use crate::convert::{FromWasmAbi, IntoWasmAbi, RefFromWasmAbi, RefMutFromWasmAbi, WasmAbi}; +use cfg_if::cfg_if; if_std! { use core::mem; @@ -124,7 +124,6 @@ vectors! { u8 i8 u16 i16 u32 i32 u64 i64 usize isize f32 f64 } - cfg_if! { if #[cfg(feature = "enable-interning")] { #[inline] @@ -141,7 +140,6 @@ cfg_if! { } } - if_std! { impl IntoWasmAbi for Vec where Box<[T]>: IntoWasmAbi { type Abi = as IntoWasmAbi>::Abi; diff --git a/src/describe.rs b/src/describe.rs index a59257f9..b1cfeaaf 100644 --- a/src/describe.rs +++ b/src/describe.rs @@ -3,8 +3,8 @@ #![doc(hidden)] -use cfg_if::cfg_if; use crate::{Clamped, JsValue}; +use cfg_if::cfg_if; macro_rules! tys { ($($a:ident)*) => (tys! { @ ($($a)*) 0 }); diff --git a/src/lib.rs b/src/lib.rs index 608d2ad3..7cbcb968 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -57,7 +57,6 @@ pub mod prelude { } } - pub mod convert; pub mod describe;