mirror of
https://github.com/eyre-rs/eyre.git
synced 2025-09-28 05:21:34 +00:00
Fix anyhow_kind dispatch on owned value
This commit is contained in:
parent
d0c25a6b1c
commit
da60588d02
@ -42,7 +42,7 @@
|
||||
// #[allow(unused_imports)]
|
||||
// use $crate::private::{AdhocKind, TraitKind};
|
||||
// let error = $msg;
|
||||
// error.anyhow_kind().new(error)
|
||||
// (&error).anyhow_kind().new(error)
|
||||
|
||||
use crate::Error;
|
||||
use std::error::Error as StdError;
|
||||
|
@ -404,7 +404,7 @@ macro_rules! anyhow {
|
||||
#[allow(unused_imports)]
|
||||
use $crate::private::{AdhocKind, TraitKind};
|
||||
let error = $err;
|
||||
error.anyhow_kind().new(error)
|
||||
(&error).anyhow_kind().new(error)
|
||||
});
|
||||
($fmt:expr, $($arg:tt)*) => {
|
||||
$crate::private::new_adhoc(format!($fmt, $($arg)*))
|
||||
|
@ -35,6 +35,10 @@ fn test_variable_source() {
|
||||
let msg = "oh no!";
|
||||
let error = anyhow!(msg);
|
||||
assert!(error.source().is_none());
|
||||
|
||||
let msg = msg.to_owned();
|
||||
let error = anyhow!(msg);
|
||||
assert!(error.source().is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
x
Reference in New Issue
Block a user