From 5b4cb9b124e08cfdc838dd078488fd54ac9ecb34 Mon Sep 17 00:00:00 2001 From: Stefan Sterz Date: Wed, 6 Mar 2024 13:36:05 +0100 Subject: [PATCH] auth-api: fix types `compilefail` test due to missing `use` statements they failed, as they should, but for the wrong reasons. also adapt a test case that presumably was meant to test whether `TokennameRef` can be compared, but instead duplicated the `UsernameRef` test case. Signed-off-by: Stefan Sterz --- proxmox-auth-api/src/types.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/proxmox-auth-api/src/types.rs b/proxmox-auth-api/src/types.rs index 659f2807..21136824 100644 --- a/proxmox-auth-api/src/types.rs +++ b/proxmox-auth-api/src/types.rs @@ -111,6 +111,7 @@ pub const PROXMOX_AUTH_REALM_SCHEMA: Schema = PROXMOX_AUTH_REALM_STRING_SCHEMA.s /// `.as_str()`. /// /// ```compile_fail +/// # use proxmox_auth_api::types::Username; /// fn test(a: Username, b: Username) -> bool { /// a == b // illegal and does not compile /// } @@ -332,21 +333,24 @@ pub struct TokennameRef(str); #[doc(hidden)] /// ```compile_fail +/// # use proxmox_auth_api::types::Username; /// let a: Username = unsafe { std::mem::zeroed() }; /// let b: Username = unsafe { std::mem::zeroed() }; /// let _ = ::eq(&a, &b); /// ``` /// /// ```compile_fail +/// # use proxmox_auth_api::types::UsernameRef; /// let a: &UsernameRef = unsafe { std::mem::zeroed() }; /// let b: &UsernameRef = unsafe { std::mem::zeroed() }; /// let _ = <&UsernameRef as PartialEq>::eq(a, b); /// ``` /// /// ```compile_fail -/// let a: &UsernameRef = unsafe { std::mem::zeroed() }; -/// let b: &UsernameRef = unsafe { std::mem::zeroed() }; -/// let _ = <&UsernameRef as PartialEq>::eq(&a, &b); +/// # use proxmox_auth_api::types::TokennameRef; +/// let a: &TokennameRef = unsafe { std::mem::zeroed() }; +/// let b: &TokennameRef = unsafe { std::mem::zeroed() }; +/// let _ = <&TokennameRef as PartialEq>::eq(&a, &b); /// ``` struct _AssertNoEqImpl;