Cleanup lint in human.

This commit is contained in:
Bill Thiede 2019-10-13 07:55:06 -07:00
parent 92c8f1980c
commit 38317de40d

View File

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