mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
devices: Remove unnecessary clippy directives
Clippy passes fine without these and remove some genuinely unused code. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
@@ -61,12 +61,10 @@ pub enum ClockType {
|
|||||||
/// Equivalent to `libc::CLOCK_MONOTONIC`.
|
/// Equivalent to `libc::CLOCK_MONOTONIC`.
|
||||||
Monotonic,
|
Monotonic,
|
||||||
/// Equivalent to `libc::CLOCK_REALTIME`.
|
/// Equivalent to `libc::CLOCK_REALTIME`.
|
||||||
#[allow(dead_code)]
|
|
||||||
Real,
|
Real,
|
||||||
/// Equivalent to `libc::CLOCK_PROCESS_CPUTIME_ID`.
|
/// Equivalent to `libc::CLOCK_PROCESS_CPUTIME_ID`.
|
||||||
ProcessCpu,
|
ProcessCpu,
|
||||||
/// Equivalent to `libc::CLOCK_THREAD_CPUTIME_ID`.
|
/// Equivalent to `libc::CLOCK_THREAD_CPUTIME_ID`.
|
||||||
#[allow(dead_code)]
|
|
||||||
ThreadCpu,
|
ThreadCpu,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +99,7 @@ pub struct LocalTime {
|
|||||||
|
|
||||||
impl LocalTime {
|
impl LocalTime {
|
||||||
/// Returns the [LocalTime](struct.LocalTime.html) structure for the calling moment.
|
/// Returns the [LocalTime](struct.LocalTime.html) structure for the calling moment.
|
||||||
#[allow(dead_code)]
|
#[cfg(test)]
|
||||||
pub fn now() -> LocalTime {
|
pub fn now() -> LocalTime {
|
||||||
let mut timespec = libc::timespec {
|
let mut timespec = libc::timespec {
|
||||||
tv_sec: 0,
|
tv_sec: 0,
|
||||||
@@ -173,22 +171,6 @@ impl Default for TimestampUs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a timestamp in nanoseconds from a monotonic clock.
|
|
||||||
///
|
|
||||||
/// Uses `_rdstc` on `x86_64` and [`get_time`](fn.get_time.html) on other architectures.
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub fn timestamp_cycles() -> u64 {
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
// SAFETY: there's nothing that can go wrong with this call.
|
|
||||||
unsafe {
|
|
||||||
std::arch::x86_64::_rdtsc() as u64
|
|
||||||
}
|
|
||||||
#[cfg(not(target_arch = "x86_64"))]
|
|
||||||
{
|
|
||||||
get_time(ClockType::Monotonic)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns a timestamp in nanoseconds based on the provided clock type.
|
/// Returns a timestamp in nanoseconds based on the provided clock type.
|
||||||
///
|
///
|
||||||
/// # Arguments
|
/// # Arguments
|
||||||
@@ -525,7 +507,6 @@ mod tests {
|
|||||||
($test_name: ident, $write_fn_name: ident, $read_fn_name: ident, $is_be: expr, $data_type: ty) => {
|
($test_name: ident, $write_fn_name: ident, $read_fn_name: ident, $is_be: expr, $data_type: ty) => {
|
||||||
#[test]
|
#[test]
|
||||||
fn $test_name() {
|
fn $test_name() {
|
||||||
#[allow(overflowing_literals)]
|
|
||||||
let test_cases = [
|
let test_cases = [
|
||||||
(
|
(
|
||||||
0x0123_4567_89AB_CDEF as u64,
|
0x0123_4567_89AB_CDEF as u64,
|
||||||
|
|||||||
@@ -33,11 +33,9 @@ bitflags! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused_macros)]
|
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
macro_rules! generate_read_fn {
|
macro_rules! generate_read_fn {
|
||||||
($fn_name: ident, $data_type: ty, $byte_type: ty, $type_size: expr, $endian_type: ident) => {
|
($fn_name: ident, $data_type: ty, $byte_type: ty, $type_size: expr, $endian_type: ident) => {
|
||||||
#[allow(dead_code)]
|
|
||||||
pub fn $fn_name(input: &[$byte_type]) -> $data_type {
|
pub fn $fn_name(input: &[$byte_type]) -> $data_type {
|
||||||
assert!($type_size == std::mem::size_of::<$data_type>());
|
assert!($type_size == std::mem::size_of::<$data_type>());
|
||||||
let mut array = [0u8; $type_size];
|
let mut array = [0u8; $type_size];
|
||||||
@@ -49,11 +47,9 @@ macro_rules! generate_read_fn {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused_macros)]
|
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
macro_rules! generate_write_fn {
|
macro_rules! generate_write_fn {
|
||||||
($fn_name: ident, $data_type: ty, $byte_type: ty, $endian_type: ident) => {
|
($fn_name: ident, $data_type: ty, $byte_type: ty, $endian_type: ident) => {
|
||||||
#[allow(dead_code)]
|
|
||||||
pub fn $fn_name(buf: &mut [$byte_type], n: $data_type) {
|
pub fn $fn_name(buf: &mut [$byte_type], n: $data_type) {
|
||||||
for (byte, read) in buf
|
for (byte, read) in buf
|
||||||
.iter_mut()
|
.iter_mut()
|
||||||
|
|||||||
Reference in New Issue
Block a user