refactor/printf ~ fix cargo clippy complaint (clippy::needless_borrow)

This commit is contained in:
Roy Ivy III
2021-06-06 19:28:24 -05:00
parent ad486a77dc
commit 750b68a44c
6 changed files with 8 additions and 8 deletions
@@ -26,7 +26,7 @@ impl Formatter for CninetyNineHexFloatf {
) -> Option<FormatPrimitive> {
let second_field = field.second_field.unwrap_or(6) + 1;
let analysis = FloatAnalysis::analyze(
&str_in,
str_in,
initial_prefix,
Some(second_field as usize),
None,
@@ -298,11 +298,11 @@ pub fn get_primitive_dec(
pub fn primitive_to_str_common(prim: &FormatPrimitive, field: &FormatField) -> String {
let mut final_str = String::new();
if let Some(ref prefix) = prim.prefix {
final_str.push_str(&prefix);
final_str.push_str(prefix);
}
match prim.pre_decimal {
Some(ref pre_decimal) => {
final_str.push_str(&pre_decimal);
final_str.push_str(pre_decimal);
}
None => {
panic!(
@@ -21,7 +21,7 @@ impl Formatter for Floatf {
) -> Option<FormatPrimitive> {
let second_field = field.second_field.unwrap_or(6) + 1;
let analysis = FloatAnalysis::analyze(
&str_in,
str_in,
initial_prefix,
None,
Some(second_field as usize),
@@ -252,7 +252,7 @@ impl Formatter for Intf {
fn primitive_to_str(&self, prim: &FormatPrimitive, field: FormatField) -> String {
let mut final_str: String = String::new();
if let Some(ref prefix) = prim.prefix {
final_str.push_str(&prefix);
final_str.push_str(prefix);
}
// integral second fields is zero-padded minimum-width
// which gets handled before general minimum-width
@@ -266,7 +266,7 @@ impl Formatter for Intf {
i -= 1;
}
}
final_str.push_str(&pre_decimal);
final_str.push_str(pre_decimal);
}
None => {
panic!(
@@ -235,7 +235,7 @@ pub fn num_format(field: &FormatField, in_str_opt: Option<&String>) -> Option<St
let as_str = format!("{}", provided_num);
let initial_prefix = get_initial_prefix(
&as_str,
&field.field_type
field.field_type
);
tmp=formatter.get_primitive(field, &initial_prefix, &as_str)
.expect("err during default provided num");
+1 -1
View File
@@ -275,7 +275,7 @@ impl SubParser {
}
None => {
text_so_far.push('%');
err_conv(&text_so_far);
err_conv(text_so_far);
false
}
}