Skip to content

Commit

Permalink
Makes linter happy.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Mar 29, 2024
1 parent 351e7f7 commit bfc91ab
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/aligned_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ pub fn is_memory_aligned(ptr: usize, align: usize) -> bool {
.unwrap_or(false)
}

#[allow(clippy::arithmetic_side_effects)]
#[cfg(test)]
mod tests {
#![allow(clippy::arithmetic_side_effects)]
use {super::*, std::io::Write};

fn do_test<const ALIGN: usize>() {
Expand Down
1 change: 0 additions & 1 deletion src/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,6 @@ pub(crate) fn get_ro_region(ro_section: &Section, elf: &[u8]) -> MemoryRegion {
mod test {
use super::*;
use crate::{
ebpf,
elf_parser::{
// FIXME consts::{ELFCLASS32, ELFDATA2MSB, ET_REL},
consts::{ELFCLASS32, ELFDATA2MSB, ET_REL},
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ trait ErrCheckedArithmetic: Sized {
fn err_checked_add(self, other: Self) -> Result<Self, ArithmeticOverflow>;
fn err_checked_sub(self, other: Self) -> Result<Self, ArithmeticOverflow>;
fn err_checked_mul(self, other: Self) -> Result<Self, ArithmeticOverflow>;
#[allow(dead_code)]
fn err_checked_div(self, other: Self) -> Result<Self, ArithmeticOverflow>;
}
struct ArithmeticOverflow;
Expand Down
2 changes: 1 addition & 1 deletion src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ macro_rules! declare_builtin_function {
#[cfg(test)]
mod tests {
use super::*;
use crate::{program::BuiltinFunction, syscalls, vm::TestContextObject};
use crate::{syscalls, vm::TestContextObject};

#[test]
fn test_builtin_program_eq() {
Expand Down
8 changes: 6 additions & 2 deletions src/static_analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ impl<'a> Analysis<'a> {
fn link_cfg_edges(&mut self, cfg_edges: Vec<(usize, Vec<usize>)>, both_directions: bool) {
for (source, destinations) in cfg_edges {
if both_directions {
self.cfg_nodes.get_mut(&source).unwrap().destinations = destinations.clone();
self.cfg_nodes
.get_mut(&source)
.unwrap()
.destinations
.clone_from(&destinations);
}
for destination in &destinations {
self.cfg_nodes
Expand Down Expand Up @@ -350,7 +354,7 @@ impl<'a> Analysis<'a> {
}
if let Some(next_cfg_edge) = cfg_edge_iter.peek() {
if *next_cfg_edge.0 <= cfg_node_end {
cfg_node.destinations = next_cfg_edge.1 .1.clone();
cfg_node.destinations.clone_from(&next_cfg_edge.1 .1);
cfg_edge_iter.next();
continue;
}
Expand Down

0 comments on commit bfc91ab

Please sign in to comment.