Skip to content

Commit

Permalink
Fix code not following new linting rules in testing framework
Browse files Browse the repository at this point in the history
  • Loading branch information
faern committed Jan 4, 2024
1 parent f7b74c7 commit 9335af9
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions test/test-manager/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ impl Logger {
}

impl log::Log for Logger {
fn enabled(&self, metadata: &log::Metadata) -> bool {
fn enabled(&self, metadata: &log::Metadata<'_>) -> bool {
let inner = self.inner.lock().unwrap();
inner.env_logger.enabled(metadata)
}

fn log(&self, record: &log::Record) {
fn log(&self, record: &log::Record<'_>) {
if !self.enabled(record.metadata()) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion test/test-manager/src/network_monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct ParsedPacket {
impl PacketCodec for Codec {
type Item = Option<ParsedPacket>;

fn decode(&mut self, packet: pcap::Packet) -> Self::Item {
fn decode(&mut self, packet: pcap::Packet<'_>) -> Self::Item {
if self.no_frame {
// skip utun header specifying an address family
#[cfg(target_os = "macos")]
Expand Down
2 changes: 1 addition & 1 deletion test/test-manager/src/vm/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub fn packages(config: &VmConfig, guest_ip: std::net::IpAddr) -> Result<Update>

// Pretty-printing for an `Update` action.
impl fmt::Display for Update {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Update::Nothing => write!(formatter, "Nothing was updated"),
Update::Logs(output) => output
Expand Down
5 changes: 3 additions & 2 deletions test/test-rpc/src/logging.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use colored::Colorize;
use std::fmt;
use serde::{Deserialize, Serialize};

pub type Result<T> = std::result::Result<T, Error>;
Expand All @@ -19,8 +20,8 @@ pub enum Output {
Other(String),
}

impl std::fmt::Display for Output {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
impl fmt::Display for Output {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Output::Error(s) => f.write_fmt(format_args!("{}", s.as_str().red())),
Output::Warning(s) => f.write_fmt(format_args!("{}", s.as_str().yellow())),
Expand Down
2 changes: 1 addition & 1 deletion test/test-rpc/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl ConnectionHandle {
}

/// Returns a future that is notified when `reset_connected_state` is called.
pub fn notified_reset(&self) -> Notified {
pub fn notified_reset(&self) -> Notified<'_> {
self.reset_notify.notified()
}

Expand Down
4 changes: 2 additions & 2 deletions test/test-runner/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ pub static LOGGER: Lazy<StdOutBuffer> = Lazy::new(|| {
pub struct StdOutBuffer(pub Mutex<Receiver<Output>>, pub Sender<Output>);

impl log::Log for StdOutBuffer {
fn enabled(&self, metadata: &Metadata) -> bool {
fn enabled(&self, metadata: &Metadata<'_>) -> bool {
metadata.level() <= Level::Info
}

fn log(&self, record: &Record) {
fn log(&self, record: &Record<'_>) {
if self.enabled(record.metadata()) {
match record.metadata().level() {
Level::Error => {
Expand Down

0 comments on commit 9335af9

Please sign in to comment.