test_infra: Implement fmt::Display for VerbosityLevel
warning: direct implementation of `ToString`
--> test_infra/src/lib.rs:1214:1
|
1214 | / impl ToString for VerbosityLevel {
1215 | | fn to_string(&self) -> String {
1216 | | use VerbosityLevel::*;
1217 | | match self {
... |
1222 | | }
1223 | | }
| |_^
|
= help: prefer implementing `Display` instead
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_trait_impl
= note: `#[warn(clippy::to_string_trait_impl)]` on by default
Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
This commit is contained in:
parent
1e3d21e504
commit
ab9fc3a8a0
1 changed files with 7 additions and 5 deletions
|
|
@ -10,6 +10,7 @@ use serde_json::Value;
|
|||
use ssh2::Session;
|
||||
use std::env;
|
||||
use std::ffi::OsStr;
|
||||
use std::fmt::Display;
|
||||
use std::io;
|
||||
use std::io::{Read, Write};
|
||||
use std::net::TcpListener;
|
||||
|
|
@ -1211,14 +1212,15 @@ impl Default for VerbosityLevel {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToString for VerbosityLevel {
|
||||
fn to_string(&self) -> String {
|
||||
impl Display for VerbosityLevel {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use VerbosityLevel::*;
|
||||
match self {
|
||||
Warn => "".to_string(),
|
||||
Info => "-v".to_string(),
|
||||
Debug => "-vv".to_string(),
|
||||
Warn => (),
|
||||
Info => write!(f, "-v")?,
|
||||
Debug => write!(f, "-vv")?,
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue