diff src/items.rs @ 12:30831c70e5c0

Remove PhantomData usage. PhantomData is used through the library to substitute associated constants (to types). However, calling `PamItem::item_type(PhantomData<T>)` can easily be substituted by calling `T::item_type()`, getting rid of the need for PhantomData.
author Marc Brinkmann <git@marcbrinkmann.de>
date Sun, 26 Feb 2017 12:12:36 +0100 (2017-02-26)
parents 827faa554528
children
line wrap: on
line diff
--- a/src/items.rs	Sun Feb 26 12:08:11 2017 +0100
+++ b/src/items.rs	Sun Feb 26 12:12:36 2017 +0100
@@ -1,4 +1,3 @@
-use std::marker::PhantomData;
 use constants::{PamItemType, PAM_SERVICE, PAM_USER, PAM_USER_PROMPT, PAM_TTY, PAM_RUSER, PAM_RHOST,
                 PAM_AUTHTOK, PAM_OLDAUTHTOK};
 use module::PamItem;
@@ -8,7 +7,7 @@
 pub struct PamService {}
 
 impl PamItem for PamService {
-    fn item_type(_: PhantomData<Self>) -> PamItemType {
+    fn item_type() -> PamItemType {
         PAM_SERVICE
     }
 }
@@ -16,7 +15,7 @@
 pub struct PamUser {}
 
 impl PamItem for PamUser {
-    fn item_type(_: PhantomData<Self>) -> PamItemType {
+    fn item_type() -> PamItemType {
         PAM_USER
     }
 }
@@ -24,7 +23,7 @@
 pub struct PamUserPrompt {}
 
 impl PamItem for PamUserPrompt {
-    fn item_type(_: PhantomData<Self>) -> PamItemType {
+    fn item_type() -> PamItemType {
         PAM_USER_PROMPT
     }
 }
@@ -32,7 +31,7 @@
 pub struct PamTty {}
 
 impl PamItem for PamTty {
-    fn item_type(_: PhantomData<Self>) -> PamItemType {
+    fn item_type() -> PamItemType {
         PAM_TTY
     }
 }
@@ -40,7 +39,7 @@
 pub struct PamRUser {}
 
 impl PamItem for PamRUser {
-    fn item_type(_: PhantomData<Self>) -> PamItemType {
+    fn item_type() -> PamItemType {
         PAM_RUSER
     }
 }
@@ -48,7 +47,7 @@
 pub struct PamRHost {}
 
 impl PamItem for PamRHost {
-    fn item_type(_: PhantomData<Self>) -> PamItemType {
+    fn item_type() -> PamItemType {
         PAM_RHOST
     }
 }
@@ -56,7 +55,7 @@
 pub struct PamAuthTok {}
 
 impl PamItem for PamAuthTok {
-    fn item_type(_: PhantomData<Self>) -> PamItemType {
+    fn item_type() -> PamItemType {
         PAM_AUTHTOK
     }
 }
@@ -64,7 +63,7 @@
 pub struct PamOldAuthTok {}
 
 impl PamItem for PamOldAuthTok {
-    fn item_type(_: PhantomData<Self>) -> PamItemType {
+    fn item_type() -> PamItemType {
         PAM_OLDAUTHTOK
     }
 }