From a990de90fe41456a23e58bd087d2f107d321f3a1 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Fri, 19 Jul 2024 16:37:58 +0400 Subject: Deleted vendor folder --- vendor/miette/src/eyreish/into_diagnostic.rs | 33 ---------------------------- 1 file changed, 33 deletions(-) delete mode 100644 vendor/miette/src/eyreish/into_diagnostic.rs (limited to 'vendor/miette/src/eyreish/into_diagnostic.rs') diff --git a/vendor/miette/src/eyreish/into_diagnostic.rs b/vendor/miette/src/eyreish/into_diagnostic.rs deleted file mode 100644 index 6480013..0000000 --- a/vendor/miette/src/eyreish/into_diagnostic.rs +++ /dev/null @@ -1,33 +0,0 @@ -use thiserror::Error; - -use crate::{Diagnostic, Report}; - -/// Convenience [`Diagnostic`] that can be used as an "anonymous" wrapper for -/// Errors. This is intended to be paired with [`IntoDiagnostic`]. -#[derive(Debug, Error)] -#[error(transparent)] -struct DiagnosticError(Box); -impl Diagnostic for DiagnosticError {} - -/** -Convenience trait that adds a [`.into_diagnostic()`](IntoDiagnostic::into_diagnostic) method that converts a type implementing -[`std::error::Error`] to a [`Result`]. - -## Warning - -Calling this on a type implementing [`Diagnostic`] will reduce it to the common denominator of -[`std::error::Error`]. Meaning all extra information provided by [`Diagnostic`] will be -inaccessible. If you have a type implementing [`Diagnostic`] consider simply returning it or using -[`Into`] or the [`Try`](std::ops::Try) operator (`?`). -*/ -pub trait IntoDiagnostic { - /// Converts [`Result`] types that return regular [`std::error::Error`]s - /// into a [`Result`] that returns a [`Diagnostic`]. - fn into_diagnostic(self) -> Result; -} - -impl IntoDiagnostic for Result { - fn into_diagnostic(self) -> Result { - self.map_err(|e| DiagnosticError(Box::new(e)).into()) - } -} -- cgit v1.2.3