From 5a54935bc9e3d9532555dd220b10b96068d3ac2f Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 11 Sep 2019 13:55:56 +0200 Subject: [PATCH] clippy: fix pointer to temporary value Signed-off-by: Wolfgang Bumiller --- src/tools.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools.rs b/src/tools.rs index 6346a136..6b91dd0e 100644 --- a/src/tools.rs +++ b/src/tools.rs @@ -200,7 +200,8 @@ where /// Returns the Unix uid/gid for the sepcified system user. pub fn getpwnam_ugid(username: &str) -> Result<(libc::uid_t, libc::gid_t), Error> { - let info = unsafe { libc::getpwnam(std::ffi::CString::new(username).unwrap().as_ptr()) }; + let username = std::ffi::CString::new(username).unwrap(); + let info = unsafe { libc::getpwnam(username.as_ptr()) }; if info == std::ptr::null_mut() { bail!("getwpnam '{}' failed", username); }