From 6ac06760adc7fc84f6a9f54f7d3c3193fa461a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Fri, 2 Sep 2022 11:23:19 +0200 Subject: [PATCH] cargo fmt --- lib/api/src/js/error.rs | 4 ++-- lib/api/src/js/trap.rs | 14 ++++++++++---- lib/compiler/src/engine/trap/error.rs | 4 ++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/api/src/js/error.rs b/lib/api/src/js/error.rs index e11c6f4a5..47fe3335a 100644 --- a/lib/api/src/js/error.rs +++ b/lib/api/src/js/error.rs @@ -1,9 +1,9 @@ +#[cfg(feature = "core")] +use crate::alloc::borrow::Cow; use crate::js::lib::std::string::String; use crate::js::trap::RuntimeError; #[cfg(feature = "std")] use std::borrow::Cow; -#[cfg(feature = "core")] -use crate::alloc::borrow::Cow; #[cfg(feature = "std")] use thiserror::Error; use wasmer_types::ImportError; diff --git a/lib/api/src/js/trap.rs b/lib/api/src/js/trap.rs index 3626c2313..c9d1ac3f3 100644 --- a/lib/api/src/js/trap.rs +++ b/lib/api/src/js/trap.rs @@ -26,7 +26,7 @@ pub trait CoreError: fmt::Debug + fmt::Display { } } -impl CoreError for T { } +impl CoreError for T {} impl dyn CoreError + 'static { /// Returns `true` if the inner type is the same as `T`. @@ -49,7 +49,9 @@ impl dyn CoreError + Send + Sync + 'static { impl dyn CoreError + Send { #[inline] /// Attempts to downcast the box to a concrete type. - pub fn downcast_core(self: Box) -> Result, Box> { + pub fn downcast_core( + self: Box, + ) -> Result, Box> { let err: Box = self; ::downcast_core(err).map_err(|s| unsafe { // Reapply the `Send` marker. @@ -73,7 +75,9 @@ impl dyn CoreError + Send + Sync { impl dyn CoreError { #[inline] /// Attempts to downcast the box to a concrete type. - pub fn downcast_core(self: Box) -> Result, Box> { + pub fn downcast_core( + self: Box, + ) -> Result, Box> { if self.core_is_equal::() { unsafe { let raw: *mut dyn CoreError = Box::into_raw(self); @@ -200,7 +204,9 @@ impl RuntimeError { #[cfg(feature = "std")] Ok(RuntimeErrorSource::User(err)) if err.is::() => Ok(*err.downcast::().unwrap()), #[cfg(feature = "core")] - Ok(RuntimeErrorSource::User(err)) if (*err).core_is_equal::() => Ok(*err.downcast_core::().unwrap()), + Ok(RuntimeErrorSource::User(err)) if (*err).core_is_equal::() => { + Ok(*err.downcast_core::().unwrap()) + } Ok(inner) => Err(Self { inner: Arc::new(inner), }), diff --git a/lib/compiler/src/engine/trap/error.rs b/lib/compiler/src/engine/trap/error.rs index 60e033985..e1c0dab5e 100644 --- a/lib/compiler/src/engine/trap/error.rs +++ b/lib/compiler/src/engine/trap/error.rs @@ -12,9 +12,9 @@ pub struct RuntimeError { inner: Arc, } -pub trait CoreError: fmt::Debug + fmt::Display + core::any::Any { } +pub trait CoreError: fmt::Debug + fmt::Display + core::any::Any {} -impl CoreError for T { } +impl CoreError for T {} /// The source of the `RuntimeError`. #[derive(Debug)]