refactor: format code using cargo fmt

This commit is contained in:
Marc-Antoine Arnaud 2023-12-19 22:03:15 +01:00
parent 7b6d831146
commit 568de4e1f0
4 changed files with 33 additions and 36 deletions

View File

@ -158,7 +158,9 @@ fn attribute_enum2() {
impl Default for Child1 {
fn default() -> Child1 {
Child1{val: "hello world".into()}
Child1 {
val: "hello world".into(),
}
}
}
@ -186,7 +188,9 @@ fn attribute_enum2() {
impl Default for Base {
fn default() -> Base {
Base::C1(Child1{val: "hello world".into()})
Base::C1(Child1 {
val: "hello world".into(),
})
}
}
@ -213,7 +217,9 @@ fn attribute_enum2() {
impl Default for Base2 {
fn default() -> Base2 {
Base2::C1(Child1{val: "hello world".into()})
Base2::C1(Child1 {
val: "hello world".into(),
})
}
}

View File

@ -39,8 +39,7 @@ fn skip_serializing_for_nested_struct() {
#[derive(YaSerialize, PartialEq, Debug)]
#[yaserde(rename = "child")]
pub struct XmlStructChild {
}
pub struct XmlStructChild {}
let model = XmlStruct {
skipped_serializing: XmlStructChild {},
@ -64,7 +63,7 @@ fn skip_serializing_for_enum() {
#[derive(YaSerialize, PartialEq, Debug)]
#[yaserde(rename = "child")]
pub enum XmlEnum {
Ok
Ok,
}
let model = XmlStruct {
@ -93,4 +92,3 @@ fn skip_serializing_for_vec() {
let content = "<base />";
serialize_and_validate!(model, content);
}

View File

@ -130,17 +130,14 @@ fn skip_serializing_if_for_nested_struct() {
#[yaserde(skip_serializing_if = "check_child")]
skipped_serializing: XmlStructChild,
}
impl XmlStruct
{
fn check_child(&self, _child:&XmlStructChild)->bool
{
impl XmlStruct {
fn check_child(&self, _child: &XmlStructChild) -> bool {
true
}
}
#[derive(YaSerialize, PartialEq, Debug)]
#[yaserde(rename = "child")]
pub struct XmlStructChild {
}
pub struct XmlStructChild {}
let model = XmlStruct {
skipped_serializing: XmlStructChild {},
@ -160,17 +157,15 @@ fn skip_serializing_if_for_enum() {
#[yaserde(skip_serializing_if = "check_enum")]
skipped_serializing: XmlEnum,
}
impl XmlStruct
{
fn check_enum(&self, _child:&XmlEnum)->bool
{
impl XmlStruct {
fn check_enum(&self, _child: &XmlEnum) -> bool {
true
}
}
#[derive(YaSerialize, PartialEq, Debug)]
#[yaserde(rename = "child")]
pub enum XmlEnum {
Ok
Ok,
}
let model = XmlStruct {
@ -191,10 +186,8 @@ fn skip_serializing_if_for_vec() {
#[yaserde(skip_serializing_if = "check_vec")]
skipped_serializing: Vec<i8>,
}
impl XmlStruct
{
fn check_vec(&self, _child:&Vec<i8>)->bool
{
impl XmlStruct {
fn check_vec(&self, _child: &Vec<i8>) -> bool {
true
}
}