Skip to content

fix: Centralize clippy #3412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions clippy.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#![warn(clippy::ptr_as_ptr)]
#![warn(clippy::undocumented_unsafe_blocks)]
#![warn(clippy::cast_lossless)]
6 changes: 3 additions & 3 deletions src/arch/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

include!("./clippy.in");

#![deny(missing_docs)]
#![warn(clippy::ptr_as_ptr)]
#![warn(clippy::undocumented_unsafe_blocks)]
#![warn(clippy::cast_lossless)]

//! Implements platform specific functionality.
//! Supported platforms: x86_64 and aarch64.
use std::{fmt, result};
Expand Down
3 changes: 2 additions & 1 deletion src/arch_gen/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

include!("./clippy.in");

#[allow(clippy::all)]
#[allow(clippy::undocumented_unsafe_blocks)]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub mod x86;
5 changes: 2 additions & 3 deletions src/cpuid/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the THIRD-PARTY file.

include!("./clippy.in");

#![deny(missing_docs)]
#![warn(clippy::ptr_as_ptr)]
#![warn(clippy::undocumented_unsafe_blocks)]
#![warn(clippy::cast_lossless)]
//! Utility for configuring the CPUID (CPU identification) for the guest microVM.

#![cfg(target_arch = "x86_64")]
Expand Down
5 changes: 2 additions & 3 deletions src/devices/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the THIRD-PARTY file.

#![warn(clippy::ptr_as_ptr)]
#![warn(clippy::undocumented_unsafe_blocks)]
#![warn(clippy::cast_lossless)]
include!("./clippy.in");

//! Emulates virtual and hardware devices.
use std::io;

Expand Down
5 changes: 2 additions & 3 deletions src/dumbo/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

include!("./clippy.in");

#![deny(missing_docs)]
#![warn(clippy::ptr_as_ptr)]
#![warn(clippy::undocumented_unsafe_blocks)]
#![warn(clippy::cast_lossless)]
//! Provides helper logic for parsing and writing protocol data units, and minimalist
//! implementations of a TCP listener, a TCP connection, and an HTTP/1.1 server.
pub mod pdu;
Expand Down
4 changes: 1 addition & 3 deletions src/firecracker/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

#![warn(clippy::ptr_as_ptr)]
#![warn(clippy::undocumented_unsafe_blocks)]
#![warn(clippy::cast_lossless)]
include!("./clippy.in");

mod api_server_adapter;
mod metrics;
Expand Down
5 changes: 2 additions & 3 deletions src/io_uring/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

include!("./clippy.in");

#![deny(missing_docs)]
#![warn(clippy::ptr_as_ptr)]
#![warn(clippy::undocumented_unsafe_blocks)]
#![warn(clippy::cast_lossless)]
//! High-level interface over Linux io_uring.
//!
//! Aims to provide an easy-to-use interface, while making some Firecracker-specific simplifying
Expand Down
4 changes: 1 addition & 3 deletions src/jailer/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

#![warn(clippy::ptr_as_ptr)]
#![warn(clippy::undocumented_unsafe_blocks)]
#![warn(clippy::cast_lossless)]
include!("./clippy.in");

mod cgroup;
mod chroot;
Expand Down
5 changes: 2 additions & 3 deletions src/logger/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

include!("./clippy.in");

#![deny(missing_docs)]
#![warn(clippy::ptr_as_ptr)]
#![warn(clippy::undocumented_unsafe_blocks)]
#![warn(clippy::cast_lossless)]
//! Crate that implements Firecracker specific functionality as far as logging and metrics
//! collecting.

Expand Down
4 changes: 1 addition & 3 deletions src/mmds/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

#![warn(clippy::ptr_as_ptr)]
#![warn(clippy::undocumented_unsafe_blocks)]
#![warn(clippy::cast_lossless)]
include!("./clippy.in");

pub mod data_store;
pub mod ns;
Expand Down
2 changes: 2 additions & 0 deletions src/net_gen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the THIRD-PARTY file.

include!("./clippy.in");

#![allow(clippy::all)]
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
Expand Down
5 changes: 2 additions & 3 deletions src/rate_limiter/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

include!("./clippy.in");

#![deny(missing_docs)]
#![warn(clippy::ptr_as_ptr)]
#![warn(clippy::undocumented_unsafe_blocks)]
#![warn(clippy::cast_lossless)]
//! # Rate Limiter
//!
//! Provides a rate limiter written in Rust useful for IO operations that need to
Expand Down
4 changes: 1 addition & 3 deletions src/rebase-snap/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

#![warn(clippy::ptr_as_ptr)]
#![warn(clippy::undocumented_unsafe_blocks)]
#![warn(clippy::cast_lossless)]
include!("./clippy.in");

use std::fs::{File, OpenOptions};
use std::io::{Seek, SeekFrom};
Expand Down
6 changes: 3 additions & 3 deletions src/seccompiler/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

include!("./clippy.in");

#![deny(missing_docs)]
#![warn(clippy::ptr_as_ptr)]
#![warn(clippy::undocumented_unsafe_blocks)]
#![warn(clippy::cast_lossless)]

//! The library crate that defines common helper functions that are generally used in
//! conjunction with seccompiler-bin.
Expand Down
6 changes: 3 additions & 3 deletions src/snapshot/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

include!("./clippy.in");

#![deny(missing_docs)]
#![warn(clippy::ptr_as_ptr)]
#![warn(clippy::undocumented_unsafe_blocks)]
#![warn(clippy::cast_lossless)]

//! Provides version tolerant serialization and deserialization facilities and
//! implements a persistent storage format for Firecracker state snapshots.
Expand Down
4 changes: 1 addition & 3 deletions src/utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

#![warn(clippy::ptr_as_ptr)]
#![warn(clippy::undocumented_unsafe_blocks)]
#![warn(clippy::cast_lossless)]
include!("./clippy.in");

// We use `utils` as a wrapper over `vmm_sys_util` to control the latter
// dependency easier (i.e. update only in one place `vmm_sys_util` version).
Expand Down
2 changes: 2 additions & 0 deletions src/virtio_gen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the THIRD-PARTY file.

include!("./clippy.in");

#![allow(clippy::all)]
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
Expand Down
3 changes: 2 additions & 1 deletion src/vm-memory/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
// Portions Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the THIRD-PARTY file.
#![warn(clippy::undocumented_unsafe_blocks)]

include!("./clippy.in");

use std::io::Error as IoError;
use std::os::unix::io::AsRawFd;
Expand Down
4 changes: 3 additions & 1 deletion src/vmm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
//! Virtual Machine Monitor that leverages the Linux Kernel-based Virtual Machine (KVM),
//! and other virtualization features to run a single lightweight micro-virtual
//! machine (microVM).

include!("./clippy.in");

#![deny(missing_docs)]
#![warn(clippy::undocumented_unsafe_blocks)]

/// Handles setup and initialization a `Vmm` object.
pub mod builder;
Expand Down