From 6a974772f1cbd1220bfc288786fdea51cadd4860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Mei=C3=9Fner?= Date: Mon, 6 Dec 2021 13:01:26 +0100 Subject: [PATCH] Deny clippy integer_arithmetic but explicitly allow it in each source file. (#235) --- .github/workflows/main.yml | 2 +- src/aligned_memory.rs | 1 + src/asm_parser.rs | 1 + src/assembler.rs | 1 + src/call_frames.rs | 1 + src/disassembler.rs | 1 + src/ebpf.rs | 1 + src/elf.rs | 1 + src/insn_builder.rs | 1 + src/jit.rs | 1 + src/memory_region.rs | 1 + src/static_analysis.rs | 1 + src/syscalls.rs | 1 + src/verifier.rs | 1 + src/vm.rs | 1 + src/x86.rs | 1 + tests/assembler.rs | 1 + tests/ubpf_execution.rs | 1 + 18 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fba4fc9d..7a707320 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: - name: Lint run: | cargo fmt --all -- --check - cargo clippy --all --tests -- --deny=warnings + cargo clippy --all --tests -- --deny=warnings --deny=clippy::integer_arithmetic shell: bash - name: Build and test run: | diff --git a/src/aligned_memory.rs b/src/aligned_memory.rs index e11d09d5..7b573af8 100644 --- a/src/aligned_memory.rs +++ b/src/aligned_memory.rs @@ -1,3 +1,4 @@ +#![allow(clippy::integer_arithmetic)] //! Aligned memory /// Provides u8 slices at a specified alignment diff --git a/src/asm_parser.rs b/src/asm_parser.rs index d945c03f..96e46007 100644 --- a/src/asm_parser.rs +++ b/src/asm_parser.rs @@ -1,3 +1,4 @@ +#![allow(clippy::integer_arithmetic)] // Copyright 2017 Rich Lane // // Licensed under the Apache License, Version 2.0 or diff --git a/src/assembler.rs b/src/assembler.rs index b0c4f240..d149f1ad 100644 --- a/src/assembler.rs +++ b/src/assembler.rs @@ -1,3 +1,4 @@ +#![allow(clippy::integer_arithmetic)] // Copyright 2017 Rich Lane // // Licensed under the Apache License, Version 2.0 or diff --git a/src/call_frames.rs b/src/call_frames.rs index b81fa029..19ed84b2 100644 --- a/src/call_frames.rs +++ b/src/call_frames.rs @@ -1,3 +1,4 @@ +#![allow(clippy::integer_arithmetic)] //! Call frame handler use crate::{ diff --git a/src/disassembler.rs b/src/disassembler.rs index ea378b93..d5728c28 100644 --- a/src/disassembler.rs +++ b/src/disassembler.rs @@ -1,3 +1,4 @@ +#![allow(clippy::integer_arithmetic)] // Copyright 2017 6WIND S.A. // // Licensed under the Apache License, Version 2.0 or diff --git a/src/ebpf.rs b/src/ebpf.rs index 7d5b5d09..b6d6d0bc 100644 --- a/src/ebpf.rs +++ b/src/ebpf.rs @@ -1,3 +1,4 @@ +#![allow(clippy::integer_arithmetic)] // Copyright 2016 6WIND S.A. // // Licensed under the Apache License, Version 2.0 or diff --git a/src/elf.rs b/src/elf.rs index db6a7f0f..b6e26954 100644 --- a/src/elf.rs +++ b/src/elf.rs @@ -1,3 +1,4 @@ +#![allow(clippy::integer_arithmetic)] //! This module relocates a BPF ELF // Note: Typically ELF shared objects are loaded using the program headers and diff --git a/src/insn_builder.rs b/src/insn_builder.rs index a8e7be6e..085af2f4 100644 --- a/src/insn_builder.rs +++ b/src/insn_builder.rs @@ -1,3 +1,4 @@ +#![allow(clippy::integer_arithmetic)] // Copyright 2017 Alex Dukhno // // Licensed under the Apache License, Version 2.0 or diff --git a/src/jit.rs b/src/jit.rs index d36f1483..e978387c 100644 --- a/src/jit.rs +++ b/src/jit.rs @@ -1,3 +1,4 @@ +#![allow(clippy::integer_arithmetic)] // Derived from uBPF // Copyright 2015 Big Switch Networks, Inc // (uBPF: JIT algorithm, originally in C) diff --git a/src/memory_region.rs b/src/memory_region.rs index 6a05e4d5..ae787b0a 100644 --- a/src/memory_region.rs +++ b/src/memory_region.rs @@ -1,3 +1,4 @@ +#![allow(clippy::integer_arithmetic)] //! This module defines memory regions use crate::{ diff --git a/src/static_analysis.rs b/src/static_analysis.rs index 2779c48b..21e1e79c 100644 --- a/src/static_analysis.rs +++ b/src/static_analysis.rs @@ -1,3 +1,4 @@ +#![allow(clippy::integer_arithmetic)] //! Static Byte Code Analysis use crate::disassembler::disassemble_instruction; diff --git a/src/syscalls.rs b/src/syscalls.rs index dc28e083..7413aa52 100644 --- a/src/syscalls.rs +++ b/src/syscalls.rs @@ -1,3 +1,4 @@ +#![allow(clippy::integer_arithmetic)] // Copyright 2015 Big Switch Networks, Inc // (Algorithms for uBPF syscalls, originally in C) // Copyright 2016 6WIND S.A. diff --git a/src/verifier.rs b/src/verifier.rs index f4922bdf..d6415a08 100644 --- a/src/verifier.rs +++ b/src/verifier.rs @@ -1,3 +1,4 @@ +#![allow(clippy::integer_arithmetic)] // Derived from uBPF // Copyright 2015 Big Switch Networks, Inc // (uBPF: safety checks, originally in C) diff --git a/src/vm.rs b/src/vm.rs index 7b4a3729..11426579 100644 --- a/src/vm.rs +++ b/src/vm.rs @@ -1,3 +1,4 @@ +#![allow(clippy::integer_arithmetic)] // Derived from uBPF // Copyright 2015 Big Switch Networks, Inc // (uBPF: VM architecture, parts of the interpreter, originally in C) diff --git a/src/x86.rs b/src/x86.rs index 54dc0267..55171a08 100644 --- a/src/x86.rs +++ b/src/x86.rs @@ -1,3 +1,4 @@ +#![allow(clippy::integer_arithmetic)] use crate::{ error::{EbpfError, UserDefinedError}, jit::{emit, emit_variable_length, JitCompiler, OperandSize}, diff --git a/tests/assembler.rs b/tests/assembler.rs index d36afb53..8019ea88 100644 --- a/tests/assembler.rs +++ b/tests/assembler.rs @@ -1,3 +1,4 @@ +#![allow(clippy::integer_arithmetic)] // Copyright 2017 Rich Lane // // Licensed under the Apache License, Version 2.0 or diff --git a/tests/ubpf_execution.rs b/tests/ubpf_execution.rs index 08d39c68..f385e981 100644 --- a/tests/ubpf_execution.rs +++ b/tests/ubpf_execution.rs @@ -1,3 +1,4 @@ +#![allow(clippy::integer_arithmetic)] // Copyright 2020 Solana Maintainers // // Licensed under the Apache License, Version 2.0 or