mirror of
https://github.com/LeopoldArkham/humansize
synced 2024-11-12 23:27:07 +00:00
clippy
This commit is contained in:
parent
b8464e0177
commit
f11da47922
2 changed files with 9 additions and 9 deletions
|
@ -5,7 +5,7 @@ use crate::options::FormatSizeOptions;
|
|||
use crate::IFormatter;
|
||||
|
||||
pub fn format_size_i(input: impl ToF64, options: impl AsRef<FormatSizeOptions>) -> String {
|
||||
format!("{}", IFormatter{value: input, options: options})
|
||||
format!("{}", IFormatter{value: input, options})
|
||||
}
|
||||
|
||||
pub fn format_size(input: impl ToF64 + Unsigned, options: impl AsRef<FormatSizeOptions>) -> String {
|
||||
|
@ -13,11 +13,11 @@ pub fn format_size(input: impl ToF64 + Unsigned, options: impl AsRef<FormatSizeO
|
|||
}
|
||||
|
||||
pub fn make_format_i<T: ToF64>(options: impl AsRef<FormatSizeOptions>) -> impl Fn(T) -> String {
|
||||
return move |val | -> String {
|
||||
move |val | -> String {
|
||||
format_size_i(val, &options)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn make_format<T: ToF64 + Unsigned>(options: impl AsRef<FormatSizeOptions>) -> impl Fn(T) -> String {
|
||||
return make_format_i(options);
|
||||
make_format_i(options)
|
||||
}
|
12
src/lib.rs
12
src/lib.rs
|
@ -21,12 +21,12 @@ extern crate humansize;
|
|||
use humansize::format_size;
|
||||
|
||||
fn main() {
|
||||
let size = 1000usize;
|
||||
println!("Size is {}", format_size(size, humansize::DECIMAL));
|
||||
let size = 1000usize;
|
||||
println!("Size is {}", format_size(size, humansize::DECIMAL));
|
||||
|
||||
println!("Size is {}", format_size(size, humansize::BINARY));
|
||||
println!("Size is {}", format_size(size, humansize::BINARY));
|
||||
|
||||
println!("Size is {}", format_size(size, humansize::CONVENTIONAL));
|
||||
println!("Size is {}", format_size(size, humansize::CONVENTIONAL));
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -65,7 +65,7 @@ pub struct IFormatter<T: ToF64, O: AsRef<FormatSizeOptions>> {
|
|||
|
||||
impl<V: ToF64, O: AsRef<FormatSizeOptions>> IFormatter<V, O> {
|
||||
pub fn new(value: V, options: O) -> Self {
|
||||
IFormatter{value: value, options: options}
|
||||
IFormatter{value: value, options}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ pub struct Formatter<T: ToF64 + Unsigned, O: AsRef<FormatSizeOptions>> {
|
|||
|
||||
impl<V: ToF64 + Unsigned, O: AsRef<FormatSizeOptions>> Formatter<V, O> {
|
||||
pub fn new(value: V, options: O) -> Self {
|
||||
Formatter{value: value, options: options}
|
||||
Formatter{value, options}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue