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:
parent
cb9cf3ef70
commit
901e54772e
|
@ -41,7 +41,7 @@ impl Component {
|
||||||
if let Some(val) = v.as_str() {
|
if let Some(val) = v.as_str() {
|
||||||
Component::Text(TextComponent {
|
Component::Text(TextComponent {
|
||||||
text: val.to_owned(),
|
text: val.to_owned(),
|
||||||
modifier: modifier,
|
modifier,
|
||||||
})
|
})
|
||||||
} else if v.get("text").is_some() {
|
} else if v.get("text").is_some() {
|
||||||
Component::Text(TextComponent::from_value(v, modifier))
|
Component::Text(TextComponent::from_value(v, modifier))
|
||||||
|
@ -49,7 +49,7 @@ impl Component {
|
||||||
modifier.color = Some(Color::RGB(255, 0, 0));
|
modifier.color = Some(Color::RGB(255, 0, 0));
|
||||||
Component::Text(TextComponent {
|
Component::Text(TextComponent {
|
||||||
text: "UNHANDLED".to_owned(),
|
text: "UNHANDLED".to_owned(),
|
||||||
modifier: modifier,
|
modifier,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ impl TextComponent {
|
||||||
pub fn from_value(v: &serde_json::Value, modifier: Modifier) -> Self {
|
pub fn from_value(v: &serde_json::Value, modifier: Modifier) -> Self {
|
||||||
TextComponent {
|
TextComponent {
|
||||||
text: v.get("text").unwrap().as_str().unwrap_or("").to_owned(),
|
text: v.get("text").unwrap().as_str().unwrap_or("").to_owned(),
|
||||||
modifier: modifier,
|
modifier,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ impl Map {
|
||||||
Map {
|
Map {
|
||||||
length: (bits.len()*64 + (size-1)) / size,
|
length: (bits.len()*64 + (size-1)) / size,
|
||||||
bit_size: size,
|
bit_size: size,
|
||||||
bits: bits,
|
bits,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ impl <T: MetaValue> MetadataKey<T> {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn new(index: i32) -> MetadataKey<T> {
|
fn new(index: i32) -> MetadataKey<T> {
|
||||||
MetadataKey {
|
MetadataKey {
|
||||||
index: index,
|
index,
|
||||||
ty: PhantomData,
|
ty: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue