mirror of
https://github.com/eyre-rs/eyre.git
synced 2025-09-29 05:52:13 +00:00
fix: warnings for newer rust versions
This commit is contained in:
parent
4a7b4d6988
commit
a504a60968
@ -12,13 +12,15 @@ fn join_errors(results: Vec<Result<(), SourceError>>) -> Result<(), Report> {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
results
|
let err = results
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(Result::is_err)
|
.filter(Result::is_err)
|
||||||
.map(Result::unwrap_err)
|
.map(Result::unwrap_err)
|
||||||
.fold(Err(eyre!("encountered multiple errors")), |report, e| {
|
.fold(eyre!("encountered multiple errors"), |report, e| {
|
||||||
report.error(e)
|
report.error(e)
|
||||||
})
|
});
|
||||||
|
|
||||||
|
Err(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper function to generate errors
|
/// Helper function to generate errors
|
||||||
|
@ -1038,6 +1038,13 @@ pub struct EyreHook {
|
|||||||
issue_filter: Arc<IssueFilterCallback>,
|
issue_filter: Arc<IssueFilterCallback>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type HookFunc = Box<
|
||||||
|
dyn Fn(&(dyn std::error::Error + 'static)) -> Box<dyn eyre::EyreHandler>
|
||||||
|
+ Send
|
||||||
|
+ Sync
|
||||||
|
+ 'static,
|
||||||
|
>;
|
||||||
|
|
||||||
impl EyreHook {
|
impl EyreHook {
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
pub(crate) fn default(&self, error: &(dyn std::error::Error + 'static)) -> crate::Handler {
|
pub(crate) fn default(&self, error: &(dyn std::error::Error + 'static)) -> crate::Handler {
|
||||||
@ -1091,14 +1098,7 @@ impl EyreHook {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Convert the self into the boxed type expected by `eyre::set_hook`.
|
/// Convert the self into the boxed type expected by `eyre::set_hook`.
|
||||||
pub fn into_eyre_hook(
|
pub fn into_eyre_hook(self) -> HookFunc {
|
||||||
self,
|
|
||||||
) -> Box<
|
|
||||||
dyn Fn(&(dyn std::error::Error + 'static)) -> Box<dyn eyre::EyreHandler>
|
|
||||||
+ Send
|
|
||||||
+ Sync
|
|
||||||
+ 'static,
|
|
||||||
> {
|
|
||||||
Box::new(move |e| Box::new(self.default(e)))
|
Box::new(move |e| Box::new(self.default(e)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,6 @@
|
|||||||
rust_2018_idioms,
|
rust_2018_idioms,
|
||||||
unreachable_pub,
|
unreachable_pub,
|
||||||
bad_style,
|
bad_style,
|
||||||
const_err,
|
|
||||||
dead_code,
|
dead_code,
|
||||||
improper_ctypes,
|
improper_ctypes,
|
||||||
non_shorthand_field_patterns,
|
non_shorthand_field_patterns,
|
||||||
@ -350,8 +349,6 @@
|
|||||||
overflowing_literals,
|
overflowing_literals,
|
||||||
path_statements,
|
path_statements,
|
||||||
patterns_in_fns_without_body,
|
patterns_in_fns_without_body,
|
||||||
private_in_public,
|
|
||||||
unconditional_recursion,
|
|
||||||
unused,
|
unused,
|
||||||
unused_allocation,
|
unused_allocation,
|
||||||
unused_comparisons,
|
unused_comparisons,
|
||||||
|
@ -118,7 +118,7 @@ fn test_panic_backwards_compatibility() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let output = std::process::Command::new("cargo")
|
let output = std::process::Command::new("cargo")
|
||||||
.args(&["run", "--example", "theme_test_helper"])
|
.args(["run", "--example", "theme_test_helper"])
|
||||||
.arg("--no-default-features")
|
.arg("--no-default-features")
|
||||||
.args(&features)
|
.args(&features)
|
||||||
.output()
|
.output()
|
||||||
@ -151,7 +151,6 @@ fn test_backwards_compatibility(target: String, file_name: &str) {
|
|||||||
let all: Vec<_> = s.ansi_parse().collect();
|
let all: Vec<_> = s.ansi_parse().collect();
|
||||||
let ansi: Vec<_> = s
|
let ansi: Vec<_> = s
|
||||||
.ansi_parse()
|
.ansi_parse()
|
||||||
.into_iter()
|
|
||||||
.filter_map(|x| {
|
.filter_map(|x| {
|
||||||
if let Output::Escape(ansi) = x {
|
if let Output::Escape(ansi) = x {
|
||||||
Some(ansi)
|
Some(ansi)
|
||||||
@ -166,6 +165,7 @@ fn test_backwards_compatibility(target: String, file_name: &str) {
|
|||||||
let (_control_tokens, control_ansi) = f(&control);
|
let (_control_tokens, control_ansi) = f(&control);
|
||||||
let (_target_tokens, target_ansi) = f(&target);
|
let (_target_tokens, target_ansi) = f(&target);
|
||||||
|
|
||||||
|
// pretty_assertions::assert_eq!(target, control);
|
||||||
let msg = [
|
let msg = [
|
||||||
// comment out / un-comment what you need or don't need for debugging (see below for more instructions):
|
// comment out / un-comment what you need or don't need for debugging (see below for more instructions):
|
||||||
|
|
||||||
@ -188,6 +188,7 @@ fn test_backwards_compatibility(target: String, file_name: &str) {
|
|||||||
|
|
||||||
].join("\n\n");
|
].join("\n\n");
|
||||||
|
|
||||||
|
pretty_assertions::assert_eq!(target_ansi, control_ansi, "{msg}");
|
||||||
assert_eq!(target_ansi, control_ansi, "{}", &msg);
|
assert_eq!(target_ansi, control_ansi, "{}", &msg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user