Skip to content

Commit b361db0

Browse files
committed
Improve from_anything definition using where clause
Signed-off-by: Otavio Salvador <[email protected]>
1 parent b3d7716 commit b361db0

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/unistd.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2459,11 +2459,12 @@ impl From<&libc::passwd> for User {
24592459
}
24602460

24612461
impl User {
2462-
fn from_anything(f: impl Fn(*mut libc::passwd,
2463-
*mut libc::c_char,
2464-
libc::size_t,
2465-
*mut *mut libc::passwd) -> libc::c_int)
2466-
-> Result<Option<Self>>
2462+
fn from_anything<F>(f: F) -> Result<Option<Self>>
2463+
where
2464+
F: Fn(*mut libc::passwd,
2465+
*mut libc::c_char,
2466+
libc::size_t,
2467+
*mut *mut libc::passwd) -> libc::c_int
24672468
{
24682469
let bufsize = match sysconf(SysconfVar::GETPW_R_SIZE_MAX) {
24692470
Ok(Some(n)) => n as usize,
@@ -2578,11 +2579,12 @@ impl Group {
25782579
ret
25792580
}
25802581

2581-
fn from_anything(f: impl Fn(*mut libc::group,
2582-
*mut libc::c_char,
2583-
libc::size_t,
2584-
*mut *mut libc::group) -> libc::c_int)
2585-
-> Result<Option<Self>>
2582+
fn from_anything<F>(f: F) -> Result<Option<Self>>
2583+
where
2584+
F: Fn(*mut libc::group,
2585+
*mut libc::c_char,
2586+
libc::size_t,
2587+
*mut *mut libc::group) -> libc::c_int
25862588
{
25872589
let bufsize = match sysconf(SysconfVar::GETGR_R_SIZE_MAX) {
25882590
Ok(Some(n)) => n as usize,

0 commit comments

Comments
 (0)