Skip to content

Commit 748a960

Browse files
committed
fixes again
Signed-off-by: Michael Lodder <redmike7@gmail.com>
1 parent 1001aba commit 748a960

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

src/keyring/windows.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl WindowsOsKeyRing {
3737
}
3838

3939
fn handle_err<T>(err: ::windows::core::Error) -> Result<T> {
40-
Err(KeyRingError::from(err.message().to_string()))
40+
Err(KeyRingError::from(err.message().to_string().as_str()))
4141
}
4242
}
4343

@@ -54,7 +54,9 @@ impl DynKeyRing for WindowsOsKeyRing {
5454
&mut pcredential,
5555
)
5656
}
57-
.map_err(|e: ::windows::core::Error| KeyRingError::from(e.message().to_string()))?;
57+
.map_err(|e: ::windows::core::Error| {
58+
KeyRingError::from(e.message().to_string().as_str())
59+
})?;
5860

5961
let credential: CREDENTIALW = unsafe { *pcredential };
6062

@@ -145,8 +147,9 @@ impl DynKeyRing for WindowsOsKeyRing {
145147
fn delete_secret(&mut self, id: &str) -> Result<()> {
146148
let target_name = self.get_target_name(id);
147149

148-
unsafe { CredDeleteW(PCWSTR(target_name.as_ptr()), CRED_TYPE_GENERIC, Some(0)) }
149-
.map_err(|e: ::windows::core::Error| KeyRingError::from(e.message().to_string()))?;
150+
unsafe { CredDeleteW(PCWSTR(target_name.as_ptr()), CRED_TYPE_GENERIC, Some(0)) }.map_err(
151+
|e: ::windows::core::Error| KeyRingError::from(e.message().to_string().as_str()),
152+
)?;
150153
Ok(())
151154
}
152155
}
@@ -188,7 +191,9 @@ impl ListKeyRing for WindowsOsKeyRing {
188191
&mut pcredentials,
189192
)
190193
}
191-
.map_err(|e: ::windows::core::Error| KeyRingError::from(e.message().to_string()))?;
194+
.map_err(|e: ::windows::core::Error| {
195+
KeyRingError::from(e.message().to_string().as_str())
196+
})?;
192197

193198
let credentials: &[*mut CREDENTIALW] =
194199
unsafe { std::slice::from_raw_parts(pcredentials, count as usize) };
@@ -233,8 +238,9 @@ unsafe fn get_credentials(
233238
};
234239
let mut pcredentials: *mut *mut CREDENTIALW = std::ptr::null_mut();
235240
let mut count = 0u32;
236-
unsafe { CredEnumerateW(filter, flags, &mut count, &mut pcredentials) }
237-
.map_err(|e: ::windows::core::Error| KeyRingError::from(e.message().to_string()))?;
241+
unsafe { CredEnumerateW(filter, flags, &mut count, &mut pcredentials) }.map_err(
242+
|e: ::windows::core::Error| KeyRingError::from(e.message().to_string().as_str()),
243+
)?;
238244

239245
let credentials: &[*mut CREDENTIALW] =
240246
unsafe { std::slice::from_raw_parts(pcredentials, count as usize) };

0 commit comments

Comments
 (0)