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/thiserror/tests/test_generics.rs | 161 -------------------------------- 1 file changed, 161 deletions(-) delete mode 100644 vendor/thiserror/tests/test_generics.rs (limited to 'vendor/thiserror/tests/test_generics.rs') diff --git a/vendor/thiserror/tests/test_generics.rs b/vendor/thiserror/tests/test_generics.rs deleted file mode 100644 index c94d95e..0000000 --- a/vendor/thiserror/tests/test_generics.rs +++ /dev/null @@ -1,161 +0,0 @@ -#![allow(clippy::needless_late_init, clippy::uninlined_format_args)] - -use std::fmt::{self, Debug, Display}; -use thiserror::Error; - -pub struct NoFormat; - -#[derive(Debug)] -pub struct DebugOnly; - -pub struct DisplayOnly; - -impl Display for DisplayOnly { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str("display only") - } -} - -#[derive(Debug)] -pub struct DebugAndDisplay; - -impl Display for DebugAndDisplay { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str("debug and display") - } -} - -// Should expand to: -// -// impl Display for EnumDebugField -// where -// E: Debug; -// -// impl Error for EnumDebugField -// where -// Self: Debug + Display; -// -#[derive(Error, Debug)] -pub enum EnumDebugGeneric { - #[error("{0:?}")] - FatalError(E), -} - -// Should expand to: -// -// impl Display for EnumFromGeneric; -// -// impl Error for EnumFromGeneric -// where -// EnumDebugGeneric: Error + 'static, -// Self: Debug + Display; -// -#[derive(Error, Debug)] -pub enum EnumFromGeneric { - #[error("enum from generic")] - Source(#[from] EnumDebugGeneric), -} - -// Should expand to: -// -// impl Display -// for EnumCompound -// where -// HasDisplay: Display, -// HasDebug: Debug; -// -// impl Error -// for EnumCompound -// where -// Self: Debug + Display; -// -#[derive(Error)] -pub enum EnumCompound { - #[error("{0} {1:?}")] - DisplayDebug(HasDisplay, HasDebug), - #[error("{0}")] - Display(HasDisplay, HasNeither), - #[error("{1:?}")] - Debug(HasNeither, HasDebug), -} - -impl Debug for EnumCompound { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str("EnumCompound") - } -} - -#[test] -fn test_display_enum_compound() { - let mut instance: EnumCompound; - - instance = EnumCompound::DisplayDebug(DisplayOnly, DebugOnly); - assert_eq!(format!("{}", instance), "display only DebugOnly"); - - instance = EnumCompound::Display(DisplayOnly, NoFormat); - assert_eq!(format!("{}", instance), "display only"); - - instance = EnumCompound::Debug(NoFormat, DebugOnly); - assert_eq!(format!("{}", instance), "DebugOnly"); -} - -// Should expand to: -// -// impl Display for EnumTransparentGeneric -// where -// E: Display; -// -// impl Error for EnumTransparentGeneric -// where -// E: Error, -// Self: Debug + Display; -// -#[derive(Error, Debug)] -pub enum EnumTransparentGeneric { - #[error(transparent)] - Other(E), -} - -// Should expand to: -// -// impl Display for StructDebugGeneric -// where -// E: Debug; -// -// impl Error for StructDebugGeneric -// where -// Self: Debug + Display; -// -#[derive(Error, Debug)] -#[error("{underlying:?}")] -pub struct StructDebugGeneric { - pub underlying: E, -} - -// Should expand to: -// -// impl Error for StructFromGeneric -// where -// StructDebugGeneric: Error + 'static, -// Self: Debug + Display; -// -#[derive(Error, Debug)] -pub struct StructFromGeneric { - #[from] - pub source: StructDebugGeneric, -} - -// Should expand to: -// -// impl Display for StructTransparentGeneric -// where -// E: Display; -// -// impl Error for StructTransparentGeneric -// where -// E: Error, -// Self: Debug + Display; -// -#[derive(Error, Debug)] -#[error(transparent)] -pub struct StructTransparentGeneric(E); -- cgit v1.2.3