Fix multiple issues pointed out by the new compiler

This commit is contained in:
Zhang Junyang
2024-10-13 21:39:47 +08:00
committed by Tate, Hongliang Tian
parent 5f2bd9d0ac
commit 9e4257b655
62 changed files with 211 additions and 178 deletions

View File

@ -34,8 +34,8 @@ pub(super) struct Credentials_ {
supplementary_gids: RwLock<BTreeSet<Gid>>,
/// The Linux capabilities.
///
/// This is not the capability (in static_cap.rs) enforced on rust objects.
/// Capability that child processes can inherit
inheritable_capset: AtomicCapSet,

View File

@ -84,7 +84,7 @@ impl<'a> FutexIter<'a> {
const ROBUST_LIST_LIMIT: isize = 2048;
impl<'a> Iterator for FutexIter<'a> {
impl Iterator for FutexIter<'_> {
type Item = Vaddr;
fn next(&mut self) -> Option<Self::Item> {

View File

@ -108,7 +108,7 @@ pub struct ProcessGroupGuard<'a> {
inner: MutexGuard<'a, Inner>,
}
impl<'a> ProcessGroupGuard<'a> {
impl ProcessGroupGuard<'_> {
/// Returns an iterator over the processes in the group.
pub fn iter(&self) -> ProcessGroupIter {
ProcessGroupIter {

View File

@ -44,7 +44,7 @@ pub struct ProcessTable<'a> {
inner: MutexGuard<'a, BTreeMap<Pid, Arc<Process>>>,
}
impl<'a> ProcessTable<'a> {
impl ProcessTable<'_> {
/// Returns an iterator over the processes in the table.
pub fn iter(&self) -> ProcessTableIter {
ProcessTableIter {

View File

@ -14,7 +14,6 @@ use crate::prelude::*;
/// > about the environment in which it is operating. The form of this information
/// > is a table of key-value pairs, where the keys are from the set of AT_
/// > values in elf.h.
#[allow(non_camel_case_types)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[repr(u8)]

View File

@ -338,11 +338,7 @@ fn map_segment_vmo(
vm_map_options = vm_map_options.offset(offset).handle_page_faults_around();
let map_addr = vm_map_options.build()?;
let anonymous_map_size: usize = if total_map_size > segment_size {
total_map_size - segment_size
} else {
0
};
let anonymous_map_size: usize = total_map_size.saturating_sub(segment_size);
if anonymous_map_size > 0 {
let mut anonymous_map_options = root_vmar