mirror of
https://github.com/jht5945/rust_util.git
synced 2025-12-27 15:40:03 +08:00
style: code style format
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
use std::{
|
||||
io::{ self, Error, ErrorKind },
|
||||
process::Command,
|
||||
};
|
||||
use std::{ io::{ self, Error, ErrorKind }, process::Command };
|
||||
|
||||
pub fn run_command_and_wait(cmd: &mut Command) -> io::Result<()> {
|
||||
cmd.spawn()?.wait()?;
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
use std::{
|
||||
env,
|
||||
fs::{ self, File },
|
||||
io::{ Lines, BufReader },
|
||||
path::{ Path, PathBuf },
|
||||
};
|
||||
use crate::{
|
||||
iff,
|
||||
util_os,
|
||||
util_io,
|
||||
util_msg,
|
||||
new_box_ioerror,
|
||||
XResult,
|
||||
};
|
||||
use std::{ env, fs::{ self, File }, io::{ Lines, BufReader }, path::{ Path, PathBuf } };
|
||||
use crate::{ iff, util_os, util_io, util_msg, new_box_ioerror, XResult };
|
||||
|
||||
pub struct JoinFilesReader {
|
||||
files: Vec<String>,
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::{
|
||||
time::{ SystemTime, Duration },
|
||||
};
|
||||
|
||||
use super::{ XResult, new_box_ioerror, };
|
||||
use super::{ XResult, new_box_ioerror };
|
||||
use super::util_size::get_display_size;
|
||||
use super::util_msg::print_lastline;
|
||||
use super::util_file::resolve_file_path;
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
use std::{
|
||||
env,
|
||||
io::{ self, Write },
|
||||
sync::{ Arc, Mutex },
|
||||
};
|
||||
use std::{ env, io::{ self, Write }, sync::{ Arc, Mutex } };
|
||||
|
||||
lazy_static! {
|
||||
pub static ref IS_ATTY: bool = is_atty();
|
||||
@@ -11,7 +7,7 @@ lazy_static! {
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum MessageType { DEBUG, INFO, OK, WARN, ERROR, }
|
||||
pub enum MessageType { DEBUG, INFO, OK, WARN, ERROR }
|
||||
|
||||
impl MessageType {
|
||||
pub fn get_u8_value(&self) -> u8 {
|
||||
@@ -30,7 +26,7 @@ pub fn get_logger_level() -> MessageType {
|
||||
match logger_level.trim().to_lowercase().as_str() {
|
||||
"debug" | "*" => MessageType::DEBUG,
|
||||
"info" | "?" => MessageType::INFO,
|
||||
"ok" => MessageType::OK,
|
||||
"ok" | "#" => MessageType::OK,
|
||||
"warn" | "!" => MessageType::WARN,
|
||||
"error" | "^" => MessageType::ERROR,
|
||||
_ => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::fmt::{ Display, Formatter };
|
||||
use std::fmt::{ self, Display, Formatter };
|
||||
use std::result::Result;
|
||||
use std::net::SocketAddr;
|
||||
use crate::XResult;
|
||||
@@ -29,7 +29,7 @@ impl IpAddress {
|
||||
}
|
||||
|
||||
impl Display for IpAddress {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), fmt::Error> {
|
||||
write!(f, "{}", self.to_address())
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ impl IpAddressMask {
|
||||
}
|
||||
|
||||
impl Display for IpAddressMask {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), fmt::Error> {
|
||||
write!(f, "{}", self.to_address())
|
||||
}
|
||||
}
|
||||
@@ -118,7 +118,7 @@ impl IpAddressMaskGroup {
|
||||
}
|
||||
|
||||
impl Display for IpAddressMaskGroup {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), fmt::Error> {
|
||||
write!(f, "[{}]", self.ip_address_mask_group.iter().map(|i| format!("{}", i)).collect::<Vec<_>>().join(", "))
|
||||
}
|
||||
}
|
||||
@@ -152,7 +152,7 @@ impl IpAddressAndPort {
|
||||
}
|
||||
|
||||
impl Display for IpAddressAndPort {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), fmt::Error> {
|
||||
write!(f, "{}:{}", self.ip, self.port)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user