Skip to content

Commit baebd29

Browse files
authored
Merge pull request #9985 from cakebaker/uptime_remove_unreachable_code
uucore/uptime: remove unreachable code on Windows
2 parents e2309f9 + fdf1409 commit baebd29

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/uucore/src/lib/features/uptime.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -338,13 +338,8 @@ pub fn get_nusers() -> usize {
338338
continue;
339339
}
340340

341-
let username = if !buffer.is_null() {
342-
let cstr = std::ffi::CStr::from_ptr(buffer as *const i8);
343-
cstr.to_string_lossy().to_string()
344-
} else {
345-
String::new()
346-
};
347-
if !username.is_empty() {
341+
let cstr = std::ffi::CStr::from_ptr(buffer.cast());
342+
if !cstr.is_empty() {
348343
num_user += 1;
349344
}
350345

0 commit comments

Comments
 (0)