Skip to content

Commit

Permalink
fix(error): Simplify by removing cloning
Browse files Browse the repository at this point in the history
Most people don't support cloning, so eh.

BREAKING CHANGE: Error is now not cloneable
  • Loading branch information
epage committed Dec 8, 2018
1 parent 6c99b6b commit bbd7114
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 49 deletions.
40 changes: 0 additions & 40 deletions liquid-error/src/clone.rs

This file was deleted.

12 changes: 6 additions & 6 deletions liquid-error/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ use std::error;
use std::fmt;
use std::result;

use super::ClonableError;
use super::BoxedError;
use super::Trace;

/// Convenience type alias for Liquid compiler errors
pub type Result<T> = result::Result<T, Error>;

type BoxedError = Box<error::Error + Send + Sync + 'static>;

/// Compiler error
#[derive(Clone, Debug)]
#[derive(Debug)]
pub struct Error {
inner: Box<InnerError>,
}
Expand All @@ -20,11 +20,11 @@ pub struct Error {
// `Result<T>` in the success case and spilling over from register-based returns to stack-based
// returns. There are already enough memory allocations below, one more
// shouldn't hurt.
#[derive(Clone, Debug)]
#[derive(Debug)]
struct InnerError {
msg: borrow::Cow<'static, str>,
user_backtrace: Vec<Trace>,
cause: Option<ClonableError>,
cause: Option<BoxedError>,
}

impl Error {
Expand Down Expand Up @@ -89,7 +89,7 @@ impl Error {
}

fn cause_error(mut self, cause: BoxedError) -> Self {
let cause = Some(ClonableError::new(cause));
let cause = Some(cause);
self.inner.cause = cause;
self
}
Expand Down
2 changes: 0 additions & 2 deletions liquid-error/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
#![warn(missing_debug_implementations)]
#![warn(unused_extern_crates)]

mod clone;
mod error;
mod trace;
mod result_ext;

pub use error::*;
pub use result_ext::*;
use clone::*;
use trace::*;
2 changes: 1 addition & 1 deletion liquid-value/src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ where
value.serialize(Serializer).map_err(|e| e.0)
}

#[derive(Clone, Debug)]
#[derive(Debug)]
struct SerError(error::Error);

impl fmt::Display for SerError {
Expand Down

0 comments on commit bbd7114

Please sign in to comment.