]> git.proxmox.com Git - proxmox-backup.git/commitdiff
derive PartialEq for Userid
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 30 Nov 2020 13:08:57 +0000 (14:08 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 30 Nov 2020 13:10:17 +0000 (14:10 +0100)
the manual implementation is equivalent

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/api2/types/userid.rs

index 42271904874a6ecd5d6b5948a109119ea1411bff..0ad64954d10b189a00a9b060f5993a0759193409 100644 (file)
@@ -419,12 +419,10 @@ impl<'a> TryFrom<&'a str> for &'a TokennameRef {
 }
 
 /// A complete user id consisting of a user name and a realm
-#[derive(Clone, Debug, Hash)]
+#[derive(Clone, Debug, PartialEq, Eq, Hash)]
 pub struct Userid {
     data: String,
     name_len: usize,
-    //name: Username,
-    //realm: Realm,
 }
 
 impl Userid {
@@ -460,14 +458,6 @@ lazy_static! {
     pub static ref ROOT_USERID: Userid = Userid::new("root@pam".to_string(), 4);
 }
 
-impl Eq for Userid {}
-
-impl PartialEq for Userid {
-    fn eq(&self, rhs: &Self) -> bool {
-        self.data == rhs.data && self.name_len == rhs.name_len
-    }
-}
-
 impl From<Authid> for Userid {
     fn from(authid: Authid) -> Self {
         authid.user