From ef24de24a82fe681581cc130f342363c47c0969a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 7 Jun 2024 07:48:48 +0200 Subject: Merging upstream version 1.75.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/thiserror/src/display.rs | 36 +++++++++++++++++++++++------------- vendor/thiserror/src/lib.rs | 9 ++++----- 2 files changed, 27 insertions(+), 18 deletions(-) (limited to 'vendor/thiserror/src') diff --git a/vendor/thiserror/src/display.rs b/vendor/thiserror/src/display.rs index da4905115..27098f167 100644 --- a/vendor/thiserror/src/display.rs +++ b/vendor/thiserror/src/display.rs @@ -2,29 +2,39 @@ use std::fmt::Display; use std::path::{self, Path, PathBuf}; #[doc(hidden)] -pub trait DisplayAsDisplay { - fn as_display(&self) -> Self; +pub trait AsDisplay<'a> { + // TODO: convert to generic associated type. + // https://github.com/dtolnay/thiserror/pull/253 + type Target: Display; + + fn as_display(&'a self) -> Self::Target; } -impl DisplayAsDisplay for &T { - fn as_display(&self) -> Self { - self +impl<'a, T> AsDisplay<'a> for &T +where + T: Display + 'a, +{ + type Target = &'a T; + + fn as_display(&'a self) -> Self::Target { + *self } } -#[doc(hidden)] -pub trait PathAsDisplay { - fn as_display(&self) -> path::Display<'_>; -} +impl<'a> AsDisplay<'a> for Path { + type Target = path::Display<'a>; -impl PathAsDisplay for Path { - fn as_display(&self) -> path::Display<'_> { + #[inline] + fn as_display(&'a self) -> Self::Target { self.display() } } -impl PathAsDisplay for PathBuf { - fn as_display(&self) -> path::Display<'_> { +impl<'a> AsDisplay<'a> for PathBuf { + type Target = path::Display<'a>; + + #[inline] + fn as_display(&'a self) -> Self::Target { self.display() } } diff --git a/vendor/thiserror/src/lib.rs b/vendor/thiserror/src/lib.rs index e5d295062..974063639 100644 --- a/vendor/thiserror/src/lib.rs +++ b/vendor/thiserror/src/lib.rs @@ -228,13 +228,12 @@ //! //! [`anyhow`]: https://github.com/dtolnay/anyhow -#![doc(html_root_url = "https://docs.rs/thiserror/1.0.47")] +#![doc(html_root_url = "https://docs.rs/thiserror/1.0.50")] #![allow( - // Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7421 - clippy::doc_markdown, clippy::module_name_repetitions, + clippy::needless_lifetimes, clippy::return_self_not_must_use, - clippy::wildcard_imports, + clippy::wildcard_imports )] #![cfg_attr(error_generic_member_access, feature(error_generic_member_access))] @@ -251,7 +250,7 @@ pub mod __private { #[doc(hidden)] pub use crate::aserror::AsDynError; #[doc(hidden)] - pub use crate::display::{DisplayAsDisplay, PathAsDisplay}; + pub use crate::display::AsDisplay; #[cfg(error_generic_member_access)] #[doc(hidden)] pub use crate::provide::ThiserrorProvide; -- cgit v1.2.3