diff src/conv.rs @ 8:a83c56216e21

Ran everything through rustfmt.
author Marc Brinkmann <git@marcbrinkmann.de>
date Sun, 26 Feb 2017 11:29:31 +0100
parents 9380392b9a60
children 30831c70e5c0
line wrap: on
line diff
--- a/src/conv.rs	Fri Apr 03 23:33:20 2015 -0700
+++ b/src/conv.rs	Sun Feb 26 11:29:31 2017 +0100
@@ -1,7 +1,7 @@
 use libc::{c_char, c_int};
-use std::{ptr};
+use std::ptr;
 use std::ffi::{CStr, CString};
-use std::marker::{PhantomData};
+use std::marker::PhantomData;
 
 use constants;
 use constants::*;
@@ -13,7 +13,7 @@
 #[repr(C)]
 struct PamMessage {
     msg_style: PamMessageStyle,
-    msg:       *const c_char,
+    msg: *const c_char,
 }
 
 #[repr(C)]
@@ -29,11 +29,11 @@
 /// will be relayed back.
 #[repr(C)]
 pub struct PamConv {
-    conv: extern fn(num_msg: c_int,
-                    pam_message: &&PamMessage,
-                    pam_response: &mut *const PamResponse,
-                    appdata_ptr: *const AppDataPtr
-                   ) -> PamResultCode,
+    conv: extern "C" fn(num_msg: c_int,
+                        pam_message: &&PamMessage,
+                        pam_response: &mut *const PamResponse,
+                        appdata_ptr: *const AppDataPtr)
+                        -> PamResultCode,
     appdata_ptr: *const AppDataPtr,
 }
 
@@ -65,8 +65,7 @@
         if constants::PAM_SUCCESS == ret {
             if resp_ptr.is_null() {
                 Ok(None)
-            }
-            else {
+            } else {
                 let bytes = unsafe { CStr::from_ptr((*resp_ptr).resp).to_bytes() };
                 Ok(String::from_utf8(bytes.to_vec()).ok())
             }
@@ -77,5 +76,7 @@
 }
 
 impl PamItem for PamConv {
-    fn item_type(_: PhantomData<Self>) -> PamItemType { PAM_CONV }
+    fn item_type(_: PhantomData<Self>) -> PamItemType {
+        PAM_CONV
+    }
 }