Skip to content

Commit a974a48

Browse files
committed
Removed unnecessary unsafe blocks
1 parent 007e08b commit a974a48

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/store.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl CertStore {
142142
cbData: hash.as_ref().len() as u32,
143143
pbData: hash.as_ref().as_ptr() as _,
144144
};
145-
unsafe { self.do_find(CERT_FIND_HASH, &hash_blob as *const _ as _) }
145+
self.do_find(CERT_FIND_HASH, &hash_blob as *const _ as _)
146146
}
147147

148148
// On later OS releases, we added CERT_FIND_SHA256_HASH.
@@ -161,7 +161,7 @@ impl CertStore {
161161
cbData: hash.as_ref().len() as u32,
162162
pbData: hash.as_ref().as_ptr() as _,
163163
};
164-
unsafe { self.do_find_by_sha256_property(&hash_blob as *const _ as _) }
164+
self.do_find_by_sha256_property(&hash_blob as *const _ as _)
165165
}
166166

167167
/// Find a list of certificates matching the key identifier
@@ -178,15 +178,15 @@ impl CertStore {
178178
},
179179
},
180180
};
181-
unsafe { self.do_find(CERT_FIND_CERT_ID, &cert_id as *const _ as _) }
181+
self.do_find(CERT_FIND_CERT_ID, &cert_id as *const _ as _)
182182
}
183183

184184
/// Get all certificates
185185
pub fn find_all(&self) -> Result<Vec<CertContext>> {
186-
unsafe { self.do_find(CERT_FIND_ANY, ptr::null()) }
186+
self.do_find(CERT_FIND_ANY, ptr::null())
187187
}
188188

189-
unsafe fn do_find(&self, flags: CERT_FIND_FLAGS, find_param: *const c_void) -> Result<Vec<CertContext>> {
189+
fn do_find(&self, flags: CERT_FIND_FLAGS, find_param: *const c_void) -> Result<Vec<CertContext>> {
190190
let mut certs = Vec::new();
191191

192192
unsafe {
@@ -206,7 +206,7 @@ impl CertStore {
206206
Ok(certs)
207207
}
208208

209-
unsafe fn do_find_by_sha256_property(&self, find_param: *const c_void) -> Result<Vec<CertContext>> {
209+
fn do_find_by_sha256_property(&self, find_param: *const c_void) -> Result<Vec<CertContext>> {
210210
let mut certs = Vec::new();
211211

212212
unsafe {
@@ -240,7 +240,7 @@ impl CertStore {
240240

241241
fn find_by_str(&self, pattern: &str, flags: CERT_FIND_FLAGS) -> Result<Vec<CertContext>> {
242242
let u16pattern = utf16z!(pattern);
243-
unsafe { self.do_find(flags, u16pattern.as_ptr() as _) }
243+
self.do_find(flags, u16pattern.as_ptr() as _)
244244
}
245245

246246
fn find_by_name(&self, field: &str, flags: CERT_FIND_FLAGS) -> Result<Vec<CertContext>> {

0 commit comments

Comments
 (0)