mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
Use inclusive range
Co-authored-by: Michael Debertol <michael.debertol@gmail.com>
This commit is contained in:
co-authored by
Michael Debertol
parent
cebf1f09df
commit
23f655e2a5
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user