1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Use inclusive range

Co-authored-by: Michael Debertol <michael.debertol@gmail.com>
This commit is contained in:
Jeong YunWon 2021-06-10 11:15:01 +09:00 committed by GitHub
parent cebf1f09df
commit 23f655e2a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -102,7 +102,7 @@ pub fn get_groups_gnu(arg_id: Option<u32>) -> IOResult<Vec<gid_t>> {
fn sort_groups(mut groups: Vec<gid_t>, egid: gid_t) -> Vec<gid_t> {
if let Some(index) = groups.iter().position(|&x| x == egid) {
groups[..index + 1].rotate_right(1);
groups[..=index].rotate_right(1);
} else {
groups.insert(0, egid);
}