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
co-authored by Michael Debertol
parent cebf1f09df
commit 23f655e2a5
+1 -1
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);
}