Template change as hinted by cargo clippy
There are lots of issues to be improved. Those are useful code optimizations that are easiest to adopt. Change-Id: I329b7898281a05031696d8d7739f6215444a3dc4
This commit is contained in:
parent
3bc9e13176
commit
c81e8c44b7
@ -73,7 +73,7 @@
|
||||
{%- elif data_type.value_type.type_hint == "String" %}
|
||||
.map(|(k, v)| Vec::from([k.clone(), v.clone()])),
|
||||
{%- elif data_type.value_type.__class__.__name__ == "Option" %}
|
||||
.map(|(k, v)| Vec::from([k.clone(), v.clone().unwrap_or("".to_string()).to_string()])),
|
||||
.map(|(k, v)| Vec::from([k.clone(), v.clone().unwrap_or(String::new()).to_string()])),
|
||||
{%- else %}
|
||||
.map(|(k, v)| Vec::from([k.clone(), v.to_string()])),
|
||||
{%- endif %}
|
||||
@ -109,8 +109,7 @@ impl fmt::Display for {{ subtype.name }} {
|
||||
{%- if v.type_hint not in ["Option<i32>", "Option<i64>", "Option<f32>", "Option<f64>", "Option<bool>"] %}
|
||||
.clone()
|
||||
{%- endif %}
|
||||
.map(|v| v.to_string())
|
||||
.unwrap_or("".to_string())
|
||||
.map_or(String::new(), |v| v.to_string())
|
||||
{%- endif %}
|
||||
),
|
||||
{%- endfor %}
|
||||
@ -158,7 +157,7 @@ impl fmt::Display for {{ subtype.type_hint }} {
|
||||
self.0
|
||||
.iter()
|
||||
{%- if subtype.value_type.__class__.__name__ == "Option" %}
|
||||
.map(|v| format!("{}={}", v.0, v.1.clone().unwrap_or("".to_string())))
|
||||
.map(|v| format!("{}={}", v.0, v.1.clone().unwrap_or(String::new())))
|
||||
{%- else %}
|
||||
.map(|v| format!("{}={}", v.0, v.1))
|
||||
{%- endif %}
|
||||
|
@ -364,7 +364,7 @@ Some({{ val }})
|
||||
{%- else %}
|
||||
{#- Normal array #}
|
||||
{{ dst_var }}.{{ param.remote_name }}(
|
||||
{{ val_var }}.iter().map(|v| v.into()).collect::<Vec<_>>()
|
||||
{{ val_var }}.iter().map(Into::into).collect::<Vec<_>>()
|
||||
);
|
||||
{%- endif %}
|
||||
{%- endmacro %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user