fix: warnings for newer rust versions

This commit is contained in:
Tei Roberts 2023-11-07 23:43:05 +01:00
parent 4a7b4d6988
commit a504a60968
4 changed files with 16 additions and 16 deletions

View File

@ -12,13 +12,15 @@ fn join_errors(results: Vec<Result<(), SourceError>>) -> Result<(), Report> {
return Ok(());
}
results
let err = results
.into_iter()
.filter(Result::is_err)
.map(Result::unwrap_err)
.fold(Err(eyre!("encountered multiple errors")), |report, e| {
.fold(eyre!("encountered multiple errors"), |report, e| {
report.error(e)
})
});
Err(err)
}
/// Helper function to generate errors

View File

@ -1038,6 +1038,13 @@ pub struct EyreHook {
issue_filter: Arc<IssueFilterCallback>,
}
type HookFunc = Box<
dyn Fn(&(dyn std::error::Error + 'static)) -> Box<dyn eyre::EyreHandler>
+ Send
+ Sync
+ 'static,
>;
impl EyreHook {
#[allow(unused_variables)]
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`.
pub fn into_eyre_hook(
self,
) -> Box<
dyn Fn(&(dyn std::error::Error + 'static)) -> Box<dyn eyre::EyreHandler>
+ Send
+ Sync
+ 'static,
> {
pub fn into_eyre_hook(self) -> HookFunc {
Box::new(move |e| Box::new(self.default(e)))
}
}

View File

@ -342,7 +342,6 @@
rust_2018_idioms,
unreachable_pub,
bad_style,
const_err,
dead_code,
improper_ctypes,
non_shorthand_field_patterns,
@ -350,8 +349,6 @@
overflowing_literals,
path_statements,
patterns_in_fns_without_body,
private_in_public,
unconditional_recursion,
unused,
unused_allocation,
unused_comparisons,

View File

@ -118,7 +118,7 @@ fn test_panic_backwards_compatibility() {
};
let output = std::process::Command::new("cargo")
.args(&["run", "--example", "theme_test_helper"])
.args(["run", "--example", "theme_test_helper"])
.arg("--no-default-features")
.args(&features)
.output()
@ -151,7 +151,6 @@ fn test_backwards_compatibility(target: String, file_name: &str) {
let all: Vec<_> = s.ansi_parse().collect();
let ansi: Vec<_> = s
.ansi_parse()
.into_iter()
.filter_map(|x| {
if let Output::Escape(ansi) = x {
Some(ansi)
@ -166,6 +165,7 @@ fn test_backwards_compatibility(target: String, file_name: &str) {
let (_control_tokens, control_ansi) = f(&control);
let (_target_tokens, target_ansi) = f(&target);
// pretty_assertions::assert_eq!(target, control);
let msg = [
// 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");
pretty_assertions::assert_eq!(target_ansi, control_ansi, "{msg}");
assert_eq!(target_ansi, control_ansi, "{}", &msg);
/*