diff --git a/src/morethantext/error.rs b/src/morethantext/error.rs index 497f915..c8d6a46 100644 --- a/src/morethantext/error.rs +++ b/src/morethantext/error.rs @@ -41,8 +41,8 @@ impl Generic { } } - fn add_source(&mut self, source: MTTError) { - self.source = Some(Arc::new(source)); + fn add_source>(&mut self, source: E) { + self.source = Some(Arc::new(source.into())); } } @@ -94,7 +94,7 @@ mod generics { let cld_detail = "child error"; let par_err = Generic::new(par_detail); let mut cld_err = Generic::new(cld_detail); - cld_err.add_source(par_err.into()); + cld_err.add_source(par_err); assert!( cld_err.source().unwrap().to_string() == par_detail, "/n/nGot: {}\nWant: {}\n\n",