Use as_ref instead of as_slice (#1336)

This commit is contained in:
LoveSy
2024-02-02 10:40:36 +08:00
committed by GitHub
parent f80d0764b5
commit a4b9ea04a4

View File

@@ -1,5 +1,4 @@
use anyhow::{Ok, Result}; use anyhow::{Ok, Result};
use core::slice::SlicePattern;
use getopts::Options; use getopts::Options;
use std::env; use std::env;
#[cfg(unix)] #[cfg(unix)]
@@ -46,8 +45,9 @@ fn set_identity(uid: u32, gid: u32, groups: &[u32]) {
.iter() .iter()
.map(|g| unsafe { Gid::from_raw(*g) }) .map(|g| unsafe { Gid::from_raw(*g) })
.collect::<Vec<_>>() .collect::<Vec<_>>()
.as_slice(), .as_ref(),
); )
.ok();
let gid = unsafe { Gid::from_raw(gid) }; let gid = unsafe { Gid::from_raw(gid) };
let uid = unsafe { Uid::from_raw(uid) }; let uid = unsafe { Uid::from_raw(uid) };
set_thread_res_gid(gid, gid, gid).ok(); set_thread_res_gid(gid, gid, gid).ok();