Skip to content

Commit 6b62ae2

Browse files
Petre Eftimepetreeftime
authored andcommitted
derive Eq on data structures that implement PartialEq
Signed-off-by: Petre Eftime <epetre@amazon.com>
1 parent 8e2af20 commit 6b62ae2

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

src/backend/bpf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ pub const AUDIT_ARCH_AARCH64: u32 = 183 | 0x8000_0000 | 0x4000_0000;
139139
// We cannot use the `libc::sock_filter` definition since it doesn't implement `Debug` and
140140
// `PartialEq`.
141141
#[repr(C)]
142-
#[derive(Clone, Debug, PartialEq)]
142+
#[derive(Clone, Debug, PartialEq, Eq)]
143143
pub struct sock_filter {
144144
/// Code of the instruction.
145145
pub code: ::std::os::raw::c_ushort,

src/backend/condition.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use super::{Error, Result, SeccompCmpArgLen, SeccompCmpOp};
55
use crate::backend::bpf::*;
66

77
/// Condition that a syscall must match in order to satisfy a rule.
8-
#[derive(Clone, Debug, PartialEq)]
8+
#[derive(Clone, Debug, PartialEq, Eq)]
99
pub struct SeccompCondition {
1010
/// Index of the argument that is to be compared.
1111
arg_index: u8,

src/backend/filter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::backend::rule::SeccompRule;
99
use crate::backend::{Error, Result, SeccompAction, TargetArch};
1010

1111
/// Filter containing rules assigned to syscall numbers.
12-
#[derive(Clone, Debug, PartialEq)]
12+
#[derive(Clone, Debug, PartialEq, Eq)]
1313
pub struct SeccompFilter {
1414
/// Map of syscall numbers and corresponding rule chains.
1515
rules: BTreeMap<i64, Vec<SeccompRule>>,

src/backend/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub use bpf::{sock_filter, BpfProgram, BpfProgramRef};
3232
type Result<T> = std::result::Result<T, Error>;
3333

3434
/// Backend-related errors.
35-
#[derive(Debug, PartialEq)]
35+
#[derive(Debug, PartialEq, Eq)]
3636
pub enum Error {
3737
/// Attempting to associate an empty vector of conditions to a rule.
3838
EmptyRule,
@@ -76,7 +76,7 @@ impl Display for Error {
7676

7777
/// Supported target architectures.
7878
#[allow(non_camel_case_types)]
79-
#[derive(Debug, PartialEq, Clone, Copy)]
79+
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
8080
pub enum TargetArch {
8181
/// x86_64 arch
8282
x86_64,
@@ -111,7 +111,7 @@ impl TryFrom<&str> for TargetArch {
111111
derive(Deserialize),
112112
serde(rename_all = "snake_case")
113113
)]
114-
#[derive(Clone, Debug, PartialEq)]
114+
#[derive(Clone, Debug, PartialEq, Eq)]
115115
pub enum SeccompCmpOp {
116116
/// Argument value is equal to the specified value.
117117
Eq,
@@ -131,7 +131,7 @@ pub enum SeccompCmpOp {
131131

132132
/// Seccomp argument value length.
133133
#[cfg_attr(feature = "json", derive(Deserialize), serde(rename_all = "lowercase"))]
134-
#[derive(Clone, Debug, PartialEq)]
134+
#[derive(Clone, Debug, PartialEq, Eq)]
135135
pub enum SeccompCmpArgLen {
136136
/// Argument value length is 4 bytes.
137137
Dword,
@@ -145,7 +145,7 @@ pub enum SeccompCmpArgLen {
145145
derive(Deserialize),
146146
serde(rename_all = "snake_case")
147147
)]
148-
#[derive(Clone, Debug, PartialEq)]
148+
#[derive(Clone, Debug, PartialEq, Eq)]
149149
pub enum SeccompAction {
150150
/// Allows syscall.
151151
Allow,

src/backend/rule.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::convert::{From, TryFrom};
1111
/// [`SeccompFilter`] is triggered.
1212
///
1313
/// [`SeccompFilter`]: struct.SeccompFilter.html
14-
#[derive(Clone, Debug, PartialEq)]
14+
#[derive(Clone, Debug, PartialEq, Eq)]
1515
pub struct SeccompRule {
1616
/// Conditions of rule that need to match in order for the rule to get matched.
1717
conditions: Vec<SeccompCondition>,

0 commit comments

Comments
 (0)