Use field init shorthand, instead of x:x, just x,

https://rust-lang-nursery.github.io/edition-guide/rust-2018/data-types/field-init-shorthand.html

find src -name '*.rs' -exec perl -pe 's/\b(\w+): \1,/$1,/g' -i {} \;
This commit is contained in:
ice_iix 2018-11-04 13:43:30 -08:00
parent cb9cf3ef70
commit 901e54772e
3 changed files with 5 additions and 5 deletions

View File

@ -41,7 +41,7 @@ impl Component {
if let Some(val) = v.as_str() {
Component::Text(TextComponent {
text: val.to_owned(),
modifier: modifier,
modifier,
})
} else if v.get("text").is_some() {
Component::Text(TextComponent::from_value(v, modifier))
@ -49,7 +49,7 @@ impl Component {
modifier.color = Some(Color::RGB(255, 0, 0));
Component::Text(TextComponent {
text: "UNHANDLED".to_owned(),
modifier: modifier,
modifier,
})
}
}
@ -136,7 +136,7 @@ impl TextComponent {
pub fn from_value(v: &serde_json::Value, modifier: Modifier) -> Self {
TextComponent {
text: v.get("text").unwrap().as_str().unwrap_or("").to_owned(),
modifier: modifier,
modifier,
}
}

View File

@ -63,7 +63,7 @@ impl Map {
Map {
length: (bits.len()*64 + (size-1)) / size,
bit_size: size,
bits: bits,
bits,
}
}

View File

@ -31,7 +31,7 @@ impl <T: MetaValue> MetadataKey<T> {
#[allow(dead_code)]
fn new(index: i32) -> MetadataKey<T> {
MetadataKey {
index: index,
index,
ty: PhantomData,
}
}