agent: clean up clippy warnings about '`static'

warning: Constants have by default a `'static` lifetime
   --> src/lib.rs:254:26
    |
254 | pub const PIDNAMESPACE: &'static str = "pid";
    |                         -^^^^^^^---- help: consider removing `'static`: `&str`
    |
    = note: #[warn(clippy::const_static_lifetime)] on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#const_static_lifetime

Fixes: #90

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
This commit is contained in:
Liu Jiang 2019-11-22 16:48:47 +08:00
parent 459e732ead
commit b0edfc75ff

View File

@ -8,10 +8,8 @@ extern crate serde;
extern crate serde_derive; extern crate serde_derive;
extern crate serde_json; extern crate serde_json;
use std::collections::HashMap;
// use std::io::Write;
use libc::mode_t; use libc::mode_t;
// use std::any::Any; use std::collections::HashMap;
pub mod serialize; pub mod serialize;
@ -68,7 +66,6 @@ impl Spec {
} }
} }
#[allow(dead_code)]
pub type LinuxRlimit = POSIXRlimit; pub type LinuxRlimit = POSIXRlimit;
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
@ -250,20 +247,13 @@ pub struct LinuxNamespace {
pub type LinuxNamespaceType = String; pub type LinuxNamespaceType = String;
#[allow(dead_code)] pub const PIDNAMESPACE: &str = "pid";
pub const PIDNAMESPACE: &'static str = "pid"; pub const NETWORKNAMESPACE: &str = "network";
#[allow(dead_code)] pub const MOUNTNAMESPACE: &str = "mount";
pub const NETWORKNAMESPACE: &'static str = "network"; pub const IPCNAMESPACE: &str = "ipc";
#[allow(dead_code)] pub const USERNAMESPACE: &str = "user";
pub const MOUNTNAMESPACE: &'static str = "mount"; pub const UTSNAMESPACE: &str = "uts";
#[allow(dead_code)] pub const CGROUPNAMESPACE: &str = "cgroup";
pub const IPCNAMESPACE: &'static str = "ipc";
#[allow(dead_code)]
pub const USERNAMESPACE: &'static str = "user";
#[allow(dead_code)]
pub const UTSNAMESPACE: &'static str = "uts";
#[allow(dead_code)]
pub const CGROUPNAMESPACE: &'static str = "cgroup";
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct LinuxIDMapping { pub struct LinuxIDMapping {
@ -722,72 +712,42 @@ pub struct LinuxSeccomp {
pub type Arch = String; pub type Arch = String;
#[allow(dead_code)] pub const ARCHX86: &str = "SCMP_ARCH_X86";
pub const ARCHX86: &'static str = "SCMP_ARCH_X86"; pub const ARCHX86_64: &str = "SCMP_ARCH_X86_64";
#[allow(dead_code)] pub const ARCHX32: &str = "SCMP_ARCH_X32";
pub const ARCHX86_64: &'static str = "SCMP_ARCH_X86_64"; pub const ARCHARM: &str = "SCMP_ARCH_ARM";
#[allow(dead_code)] pub const ARCHAARCH64: &str = "SCMP_ARCH_AARCH64";
pub const ARCHX32: &'static str = "SCMP_ARCH_X32"; pub const ARCHMIPS: &str = "SCMP_ARCH_MIPS";
#[allow(dead_code)] pub const ARCHMIPS64: &str = "SCMP_ARCH_MIPS64";
pub const ARCHARM: &'static str = "SCMP_ARCH_ARM"; pub const ARCHMIPS64N32: &str = "SCMP_ARCH_MIPS64N32";
#[allow(dead_code)] pub const ARCHMIPSEL: &str = "SCMP_ARCH_MIPSEL";
pub const ARCHAARCH64: &'static str = "SCMP_ARCH_AARCH64"; pub const ARCHMIPSEL64: &str = "SCMP_ARCH_MIPSEL64";
#[allow(dead_code)] pub const ARCHMIPSEL64N32: &str = "SCMP_ARCH_MIPSEL64N32";
pub const ARCHMIPS: &'static str = "SCMP_ARCH_MIPS"; pub const ARCHPPC: &str = "SCMP_ARCH_PPC";
#[allow(dead_code)] pub const ARCHPPC64: &str = "SCMP_ARCH_PPC64";
pub const ARCHMIPS64: &'static str = "SCMP_ARCH_MIPS64"; pub const ARCHPPC64LE: &str = "SCMP_ARCH_PPC64LE";
#[allow(dead_code)] pub const ARCHS390: &str = "SCMP_ARCH_S390";
pub const ARCHMIPS64N32: &'static str = "SCMP_ARCH_MIPS64N32"; pub const ARCHS390X: &str = "SCMP_ARCH_S390X";
#[allow(dead_code)] pub const ARCHPARISC: &str = "SCMP_ARCH_PARISC";
pub const ARCHMIPSEL: &'static str = "SCMP_ARCH_MIPSEL"; pub const ARCHPARISC64: &str = "SCMP_ARCH_PARISC64";
#[allow(dead_code)]
pub const ARCHMIPSEL64: &'static str = "SCMP_ARCH_MIPSEL64";
#[allow(dead_code)]
pub const ARCHMIPSEL64N32: &'static str = "SCMP_ARCH_MIPSEL64N32";
#[allow(dead_code)]
pub const ARCHPPC: &'static str = "SCMP_ARCH_PPC";
#[allow(dead_code)]
pub const ARCHPPC64: &'static str = "SCMP_ARCH_PPC64";
#[allow(dead_code)]
pub const ARCHPPC64LE: &'static str = "SCMP_ARCH_PPC64LE";
#[allow(dead_code)]
pub const ARCHS390: &'static str = "SCMP_ARCH_S390";
#[allow(dead_code)]
pub const ARCHS390X: &'static str = "SCMP_ARCH_S390X";
#[allow(dead_code)]
pub const ARCHPARISC: &'static str = "SCMP_ARCH_PARISC";
#[allow(dead_code)]
pub const ARCHPARISC64: &'static str = "SCMP_ARCH_PARISC64";
pub type LinuxSeccompAction = String; pub type LinuxSeccompAction = String;
#[allow(dead_code)] pub const ACTKILL: &str = "SCMP_ACT_KILL";
pub const ACTKILL: &'static str = "SCMP_ACT_KILL"; pub const ACTTRAP: &str = "SCMP_ACT_TRAP";
#[allow(dead_code)] pub const ACTERRNO: &str = "SCMP_ACT_ERRNO";
pub const ACTTRAP: &'static str = "SCMP_ACT_TRAP"; pub const ACTTRACE: &str = "SCMP_ACT_TRACE";
#[allow(dead_code)] pub const ACTALLOW: &str = "SCMP_ACT_ALLOW";
pub const ACTERRNO: &'static str = "SCMP_ACT_ERRNO";
#[allow(dead_code)]
pub const ACTTRACE: &'static str = "SCMP_ACT_TRACE";
#[allow(dead_code)]
pub const ACTALLOW: &'static str = "SCMP_ACT_ALLOW";
pub type LinuxSeccompOperator = String; pub type LinuxSeccompOperator = String;
#[allow(dead_code)] pub const OPNOTEQUAL: &str = "SCMP_CMP_NE";
pub const OPNOTEQUAL: &'static str = "SCMP_CMP_NE"; pub const OPLESSTHAN: &str = "SCMP_CMP_LT";
#[allow(dead_code)] pub const OPLESSEQUAL: &str = "SCMP_CMP_LE";
pub const OPLESSTHAN: &'static str = "SCMP_CMP_LT"; pub const OPEQUALTO: &str = "SCMP_CMP_EQ";
#[allow(dead_code)] pub const OPGREATEREQUAL: &str = "SCMP_CMP_GE";
pub const OPLESSEQUAL: &'static str = "SCMP_CMP_LE"; pub const OPGREATERTHAN: &str = "SCMP_CMP_GT";
#[allow(dead_code)] pub const OPMASKEDEQUAL: &str = "SCMP_CMP_MASKED_EQ";
pub const OPEQUALTO: &'static str = "SCMP_CMP_EQ";
#[allow(dead_code)]
pub const OPGREATEREQUAL: &'static str = "SCMP_CMP_GE";
#[allow(dead_code)]
pub const OPGREATERTHAN: &'static str = "SCMP_CMP_GT";
#[allow(dead_code)]
pub const OPMASKEDEQUAL: &'static str = "SCMP_CMP_MASKED_EQ";
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct LinuxSeccompArg { pub struct LinuxSeccompArg {