Moved the conversion into the function.
This commit is contained in:
		@@ -41,8 +41,8 @@ impl Generic {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn add_source(&mut self, source: MTTError) {
 | 
			
		||||
        self.source = Some(Arc::new(source));
 | 
			
		||||
    fn add_source<E: Into<MTTError>>(&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",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user