mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 04:09:48 +00:00
Windows clippy fixes for Rust 1.81
Add the minimal allow(dead_code) and feature declarations to allow the clippy checks to pass for Windows with Rust 1.81. BUG=b:365852007 TEST=tools/presubmit clippy_mingw64 Change-Id: I9ab776b07d8e9e14fe380d9b5ef1fa332788ff63 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/6013080 Reviewed-by: Kaiyi Li <kaiyili@google.com> Reviewed-by: Noah Gold <nkgold@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
parent
0a41752942
commit
fbb8137c0a
16 changed files with 32 additions and 18 deletions
|
@ -354,7 +354,10 @@ vtpm = ["devices/vtpm"]
|
|||
## Enables reporting of crosvm crashes
|
||||
crash-report = ["broker_ipc/crash-report", "crash_report"]
|
||||
|
||||
gvm = []
|
||||
perfetto = []
|
||||
process-invariants = []
|
||||
prod-build = []
|
||||
sandbox = []
|
||||
|
||||
#! ### Platform Feature Sets
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
//! Small system utility modules for usage by other modules.
|
||||
|
||||
#![cfg(windows)]
|
||||
|
||||
#[macro_use]
|
||||
pub mod ioctl;
|
||||
#[macro_use]
|
||||
|
|
|
@ -20,13 +20,13 @@ struct FILE_ZERO_DATA_INFORMATION {
|
|||
}
|
||||
|
||||
pub(crate) fn file_punch_hole(handle: &File, offset: u64, length: u64) -> io::Result<()> {
|
||||
let large_offset = if offset > std::i64::MAX as u64 {
|
||||
let large_offset = if offset > i64::MAX as u64 {
|
||||
return Err(std::io::Error::from_raw_os_error(libc::EINVAL));
|
||||
} else {
|
||||
LargeInteger::new(offset as i64)
|
||||
};
|
||||
|
||||
if (offset + length) > std::i64::MAX as u64 {
|
||||
if (offset + length) > i64::MAX as u64 {
|
||||
return Err(std::io::Error::from_raw_os_error(libc::EINVAL));
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ minigbm = ["rutabaga_gfx/minigbm"]
|
|||
x = ["gpu_display/x", "rutabaga_gfx/x"]
|
||||
virgl_renderer = ["gpu", "rutabaga_gfx/virgl_renderer"]
|
||||
vtpm = ["system_api", "protobuf", "dbus"]
|
||||
gfxstream = ["gpu", "rutabaga_gfx/gfxstream"]
|
||||
gfxstream = ["gpu", "gpu_display/gfxstream", "rutabaga_gfx/gfxstream"]
|
||||
registered_events = []
|
||||
slirp = ["net_util/slirp"]
|
||||
slirp-ring-capture = []
|
||||
|
|
|
@ -273,8 +273,8 @@ mod tests {
|
|||
#[allow(clippy::undocumented_unsafe_blocks)]
|
||||
unsafe {
|
||||
// Check that serial output is sent to the pipe
|
||||
device.write(serial_bus_address(DATA), &[b'T']);
|
||||
device.write(serial_bus_address(DATA), &[b'D']);
|
||||
device.write(serial_bus_address(DATA), b"T");
|
||||
device.write(serial_bus_address(DATA), b"D");
|
||||
|
||||
let mut read_buf: [u8; 2] = [0; 2];
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ impl TestVmSys {
|
|||
"--kernel-log-file",
|
||||
hypervisor_log_str,
|
||||
]);
|
||||
command.args(&get_hypervisor_args());
|
||||
command.args(get_hypervisor_args());
|
||||
command.args(cfg.extra_args);
|
||||
|
||||
println!("Running command: {:?}", command);
|
||||
|
|
|
@ -14,6 +14,7 @@ android_display = []
|
|||
# Stub implementation of the Android display backend. This is only used for building and testing the
|
||||
# Android display backend on a non-Android target
|
||||
android_display_stub = []
|
||||
gfxstream = []
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
|
|
|
@ -25,12 +25,18 @@ pub trait SizeExtension {
|
|||
expected_aspect_ratio: f32,
|
||||
should_adjust_width: bool,
|
||||
) -> Self;
|
||||
#[allow(dead_code)]
|
||||
fn get_largest_inner_rect_size(original_size: &Self, expected_aspect_ratio: f32) -> Self;
|
||||
#[allow(dead_code)]
|
||||
fn scale(&self, ratio: f32) -> Self;
|
||||
#[allow(dead_code)]
|
||||
fn transpose(&self) -> Self;
|
||||
#[allow(dead_code)]
|
||||
fn shorter_edge(&self) -> i32;
|
||||
fn aspect_ratio(&self) -> f32;
|
||||
#[allow(dead_code)]
|
||||
fn is_square(&self) -> bool;
|
||||
#[allow(dead_code)]
|
||||
fn is_landscape(&self) -> bool;
|
||||
}
|
||||
|
||||
|
|
|
@ -279,6 +279,7 @@ pub(crate) trait BasicWindow {
|
|||
}
|
||||
|
||||
/// Calls `RemovePropW()` internally.
|
||||
#[allow(dead_code)]
|
||||
fn remove_property(&self, property: &str) -> Result<()> {
|
||||
// SAFETY:
|
||||
// Safe because the window object won't outlive the HWND, and failures are handled below.
|
||||
|
|
|
@ -262,21 +262,25 @@ trait GpuDisplaySurface {
|
|||
}
|
||||
|
||||
/// Returns the type of the completed buffer.
|
||||
#[allow(dead_code)]
|
||||
fn buffer_completion_type(&self) -> u32 {
|
||||
0
|
||||
}
|
||||
|
||||
/// Draws the current buffer on the screen.
|
||||
#[allow(dead_code)]
|
||||
fn draw_current_buffer(&mut self) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
/// Handles a compositor-specific client event.
|
||||
#[allow(dead_code)]
|
||||
fn on_client_message(&mut self, _client_data: u64) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
/// Handles a compositor-specific shared memory completion event.
|
||||
#[allow(dead_code)]
|
||||
fn on_shm_completion(&mut self, _shm_complete: u64) {
|
||||
// no-op
|
||||
}
|
||||
|
|
|
@ -368,7 +368,7 @@ static WND_CLASS_REGISTRATION_SUCCESS: Mutex<bool> = Mutex::new(false);
|
|||
|
||||
/// # Safety
|
||||
/// - The passed in `worker` must not be destroyed before the created window is destroyed if the
|
||||
/// window creation succeeds.
|
||||
/// window creation succeeds.
|
||||
/// - The WNDPROC must be called within the same thread that calls create_window.
|
||||
/// # Arguments
|
||||
/// * `worker` - we use the runtime borrow checker to make sure there is no unwanted borrowing to
|
||||
|
|
|
@ -5,6 +5,7 @@ authors = ["The ChromiumOS Authors"]
|
|||
edition = "2021"
|
||||
|
||||
[features]
|
||||
enable_haxm_tests = []
|
||||
haxm = []
|
||||
whpx = []
|
||||
geniezone = []
|
||||
|
|
|
@ -37,6 +37,7 @@ pub struct RunMainCommand {
|
|||
/// Start a new metrics instance
|
||||
pub struct RunMetricsCommand {
|
||||
#[argh(option, arg_name = "TRANSPORT_TUBE_RD")]
|
||||
#[allow(dead_code)]
|
||||
/// tube transporter descriptor used to bootstrap the metrics process.
|
||||
pub bootstrap: usize,
|
||||
}
|
||||
|
|
|
@ -92,8 +92,11 @@ def check_rust_lockfiles(*files: str):
|
|||
# These crosvm features are currently not built upstream. Do not add to this list.
|
||||
KNOWN_DISABLED_FEATURES = [
|
||||
"default-no-sandbox",
|
||||
"gvm",
|
||||
"libvda",
|
||||
"perfetto",
|
||||
"process-invariants",
|
||||
"prod-build",
|
||||
"sandbox",
|
||||
"seccomp_trace",
|
||||
"slirp-ring-capture",
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#![allow(non_upper_case_globals)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
use std::os::raw::c_char;
|
||||
use std::os::raw::c_int;
|
||||
|
|
|
@ -228,16 +228,11 @@ impl AsyncPlaybackBufferStream for WinAudioRenderer {
|
|||
self.device.guest_frame_rate,
|
||||
self.device.incoming_buffer_size_in_frames,
|
||||
)
|
||||
.map_err(|e| {
|
||||
match &e {
|
||||
RenderError::WinAudioError(win_audio_error) => {
|
||||
log_playback_error_with_limit(win_audio_error.into())
|
||||
}
|
||||
_ => {
|
||||
log_playback_error_with_limit((&WinAudioError::Unknown).into())
|
||||
}
|
||||
.inspect_err(|e| match &e {
|
||||
RenderError::WinAudioError(win_audio_error) => {
|
||||
log_playback_error_with_limit(win_audio_error.into())
|
||||
}
|
||||
e
|
||||
_ => log_playback_error_with_limit((&WinAudioError::Unknown).into()),
|
||||
})?;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue