Cleanup lint in human.
This commit is contained in:
parent
92c8f1980c
commit
38317de40d
@ -1,3 +1,4 @@
|
|||||||
|
#![allow(dead_code)]
|
||||||
#![doc(html_root_url = "https://docs.rs/human_format")]
|
#![doc(html_root_url = "https://docs.rs/human_format")]
|
||||||
|
|
||||||
//! From https://raw.githubusercontent.com/BobGneu/human-format-rs/master/src/lib.rs
|
//! From https://raw.githubusercontent.com/BobGneu/human-format-rs/master/src/lib.rs
|
||||||
@ -72,7 +73,7 @@ impl Formatter {
|
|||||||
Formatter {
|
Formatter {
|
||||||
decimals: 2,
|
decimals: 2,
|
||||||
separator: " ".to_owned(),
|
separator: " ".to_owned(),
|
||||||
scales: Scales::SI(),
|
scales: Scales::si(),
|
||||||
forced_units: "".to_owned(),
|
forced_units: "".to_owned(),
|
||||||
forced_suffix: "".to_owned(),
|
forced_suffix: "".to_owned(),
|
||||||
}
|
}
|
||||||
@ -151,11 +152,11 @@ impl Formatter {
|
|||||||
impl Scales {
|
impl Scales {
|
||||||
/// Instantiates a new `Scales` with SI keys
|
/// Instantiates a new `Scales` with SI keys
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Scales::SI()
|
Scales::si()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Instantiates a new `Scales` with SI keys
|
/// Instantiates a new `Scales` with SI keys
|
||||||
pub fn SI() -> Self {
|
pub fn si() -> Self {
|
||||||
Scales {
|
Scales {
|
||||||
base: 1000,
|
base: 1000,
|
||||||
suffixes: vec![
|
suffixes: vec![
|
||||||
@ -173,7 +174,7 @@ impl Scales {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Instantiates a new `Scales` with Binary keys
|
/// Instantiates a new `Scales` with Binary keys
|
||||||
pub fn Binary() -> Self {
|
pub fn binary() -> Self {
|
||||||
Scales {
|
Scales {
|
||||||
base: 1000,
|
base: 1000,
|
||||||
suffixes: vec![
|
suffixes: vec![
|
||||||
@ -211,8 +212,6 @@ impl Scales {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_magnitude_multipler(&self, value: &str) -> f64 {
|
fn get_magnitude_multipler(&self, value: &str) -> f64 {
|
||||||
let ndx = 0;
|
|
||||||
|
|
||||||
for ndx in 0..self.suffixes.len() {
|
for ndx in 0..self.suffixes.len() {
|
||||||
if value == self.suffixes[ndx] {
|
if value == self.suffixes[ndx] {
|
||||||
return self.base.pow(ndx as u32) as f64;
|
return self.base.pow(ndx as u32) as f64;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user