Merge pull request #2060 from liubin/2059/delete-some-lint-attributes

agent: delete some lint attributes
This commit is contained in:
Fabiano Fidêncio 2021-06-30 16:51:07 +02:00 committed by GitHub
commit 550029c473
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 2 additions and 54 deletions

View File

@ -139,19 +139,6 @@ async fn notify_on_oom(cid: &str, dir: String) -> Result<Receiver<String>> {
register_memory_event(cid, dir, "memory.oom_control", "").await register_memory_event(cid, dir, "memory.oom_control", "").await
} }
// level is one of "low", "medium", or "critical"
async fn notify_memory_pressure(cid: &str, dir: String, level: &str) -> Result<Receiver<String>> {
if dir.is_empty() {
return Err(anyhow!("memory controller missing"));
}
if level != "low" && level != "medium" && level != "critical" {
return Err(anyhow!("invalid pressure level {}", level));
}
register_memory_event(cid, dir, "memory.pressure_level", level).await
}
async fn register_memory_event( async fn register_memory_event(
cid: &str, cid: &str,
cg_dir: String, cg_dir: String,

View File

@ -62,10 +62,7 @@ use tokio::sync::Mutex;
use crate::utils; use crate::utils;
const STATE_FILENAME: &str = "state.json";
const EXEC_FIFO_FILENAME: &str = "exec.fifo"; const EXEC_FIFO_FILENAME: &str = "exec.fifo";
const VER_MARKER: &str = "1.2.5";
const PID_NS_PATH: &str = "/proc/self/ns/pid";
const INIT: &str = "INIT"; const INIT: &str = "INIT";
const NO_PIVOT: &str = "NO_PIVOT"; const NO_PIVOT: &str = "NO_PIVOT";
@ -94,10 +91,6 @@ impl ContainerStatus {
self.cur_status self.cur_status
} }
fn pre_status(&self) -> ContainerState {
self.pre_status
}
fn transition(&mut self, to: ContainerState) { fn transition(&mut self, to: ContainerState) {
self.pre_status = self.status(); self.pre_status = self.status();
self.cur_status = to; self.cur_status = to;
@ -1401,18 +1394,8 @@ impl LinuxContainer {
logger: logger.new(o!("module" => "rustjail", "subsystem" => "container", "cid" => id)), logger: logger.new(o!("module" => "rustjail", "subsystem" => "container", "cid" => id)),
}) })
} }
fn load<T: Into<String>>(_id: T, _base: T) -> Result<Self> {
Err(anyhow!("not supported"))
}
} }
// Handle the differing rlimit types for different targets
#[cfg(target_env = "musl")]
type RlimitsType = libc::c_int;
#[cfg(target_env = "gnu")]
type RlimitsType = libc::__rlimit_resource_t;
fn setgroups(grps: &[libc::gid_t]) -> Result<()> { fn setgroups(grps: &[libc::gid_t]) -> Result<()> {
let ret = unsafe { libc::setgroups(grps.len(), grps.as_ptr() as *const libc::gid_t) }; let ret = unsafe { libc::setgroups(grps.len(), grps.as_ptr() as *const libc::gid_t) };
Errno::result(ret).map(drop)?; Errno::result(ret).map(drop)?;
@ -1626,7 +1609,7 @@ mod tests {
let pre_status = status.status(); let pre_status = status.status();
status.transition(*s); status.transition(*s);
assert_eq!(pre_status, status.pre_status()); assert_eq!(pre_status, status.pre_status);
} }
} }

View File

@ -3,15 +3,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
// #![allow(unused_attributes)]
// #![allow(unused_imports)]
// #![allow(unused_variables)]
// #![allow(unused_mut)]
#![allow(dead_code)]
// #![allow(deprecated)]
// #![allow(unused_must_use)]
#![allow(non_upper_case_globals)] #![allow(non_upper_case_globals)]
// #![allow(unused_comparisons)]
#[macro_use] #[macro_use]
#[cfg(test)] #[cfg(test)]
extern crate serial_test; extern crate serial_test;
@ -464,10 +456,6 @@ fn linux_grpc_to_oci(l: &grpc::Linux) -> oci::Linux {
} }
} }
fn linux_oci_to_grpc(_l: &oci::Linux) -> grpc::Linux {
grpc::Linux::default()
}
pub fn grpc_to_oci(grpc: &grpc::Spec) -> oci::Spec { pub fn grpc_to_oci(grpc: &grpc::Spec) -> oci::Spec {
// process // process
let process = if grpc.Process.is_some() { let process = if grpc.Process.is_some() {
@ -523,7 +511,6 @@ pub fn grpc_to_oci(grpc: &grpc::Spec) -> oci::Spec {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
#[allow(unused_macros)]
#[macro_export] #[macro_export]
macro_rules! skip_if_not_root { macro_rules! skip_if_not_root {
() => { () => {

View File

@ -112,7 +112,6 @@ lazy_static! {
} }
#[inline(always)] #[inline(always)]
#[allow(unused_variables)]
pub fn mount< pub fn mount<
P1: ?Sized + NixPath, P1: ?Sized + NixPath,
P2: ?Sized + NixPath, P2: ?Sized + NixPath,
@ -132,7 +131,6 @@ pub fn mount<
} }
#[inline(always)] #[inline(always)]
#[allow(unused_variables)]
pub fn umount2<P: ?Sized + NixPath>( pub fn umount2<P: ?Sized + NixPath>(
target: &P, target: &P,
flags: MntFlags, flags: MntFlags,
@ -452,7 +450,6 @@ fn mount_cgroups(
Ok(()) Ok(())
} }
#[allow(unused_variables)]
fn pivot_root<P1: ?Sized + NixPath, P2: ?Sized + NixPath>( fn pivot_root<P1: ?Sized + NixPath, P2: ?Sized + NixPath>(
new_root: &P1, new_root: &P1,
put_old: &P2, put_old: &P2,
@ -585,7 +582,6 @@ fn parse_mount_table() -> Result<Vec<Info>> {
} }
#[inline(always)] #[inline(always)]
#[allow(unused_variables)]
fn chroot<P: ?Sized + NixPath>(path: &P) -> Result<(), nix::Error> { fn chroot<P: ?Sized + NixPath>(path: &P) -> Result<(), nix::Error> {
#[cfg(not(test))] #[cfg(not(test))]
return unistd::chroot(path); return unistd::chroot(path);

View File

@ -559,7 +559,6 @@ mod tests {
} }
#[tokio::test] #[tokio::test]
#[allow(unused_assignments)]
async fn unset_and_remove_sandbox_storage() { async fn unset_and_remove_sandbox_storage() {
skip_if_not_root!(); skip_if_not_root!();
@ -593,7 +592,7 @@ mod tests {
assert_eq!(s.set_sandbox_storage(&destdir_path), true); assert_eq!(s.set_sandbox_storage(&destdir_path), true);
assert!(s.unset_and_remove_sandbox_storage(&destdir_path).is_ok()); assert!(s.unset_and_remove_sandbox_storage(&destdir_path).is_ok());
let mut other_dir_str = String::new(); let other_dir_str;
{ {
// Create another folder in a separate scope to ensure that is // Create another folder in a separate scope to ensure that is
// deleted // deleted

View File

@ -7,7 +7,6 @@
#[cfg(test)] #[cfg(test)]
mod test_utils { mod test_utils {
#[macro_export] #[macro_export]
#[allow(unused_macros)]
macro_rules! skip_if_root { macro_rules! skip_if_root {
() => { () => {
if nix::unistd::Uid::effective().is_root() { if nix::unistd::Uid::effective().is_root() {
@ -18,7 +17,6 @@ mod test_utils {
} }
#[macro_export] #[macro_export]
#[allow(unused_macros)]
macro_rules! skip_if_not_root { macro_rules! skip_if_not_root {
() => { () => {
if !nix::unistd::Uid::effective().is_root() { if !nix::unistd::Uid::effective().is_root() {
@ -29,7 +27,6 @@ mod test_utils {
} }
#[macro_export] #[macro_export]
#[allow(unused_macros)]
macro_rules! skip_loop_if_root { macro_rules! skip_loop_if_root {
($msg:expr) => { ($msg:expr) => {
if nix::unistd::Uid::effective().is_root() { if nix::unistd::Uid::effective().is_root() {
@ -44,7 +41,6 @@ mod test_utils {
} }
#[macro_export] #[macro_export]
#[allow(unused_macros)]
macro_rules! skip_loop_if_not_root { macro_rules! skip_loop_if_not_root {
($msg:expr) => { ($msg:expr) => {
if !nix::unistd::Uid::effective().is_root() { if !nix::unistd::Uid::effective().is_root() {