peepmatic: rustfmt

This commit is contained in:
Nick Fitzgerald
2020-05-08 12:24:53 -07:00
parent 52c6ece5f3
commit fd4f08e75f
2 changed files with 33 additions and 6 deletions

View File

@@ -155,27 +155,52 @@ where
&self,
));
}
None => return Err(de::Error::invalid_length(0, &"Automaton expects 5 elements")),
None => {
return Err(de::Error::invalid_length(
0,
&"Automaton expects 5 elements",
))
}
}
let final_states = match seq.next_element::<BTreeMap<State, TOutput>>()? {
Some(x) => x,
None => return Err(de::Error::invalid_length(1, &"Automaton expects 5 elements")),
None => {
return Err(de::Error::invalid_length(
1,
&"Automaton expects 5 elements",
))
}
};
let start_state = match seq.next_element::<State>()? {
Some(x) => x,
None => return Err(de::Error::invalid_length(2, &"Automaton expects 5 elements")),
None => {
return Err(de::Error::invalid_length(
2,
&"Automaton expects 5 elements",
))
}
};
let state_data = match seq.next_element::<Vec<Option<TState>>>()? {
Some(x) => x,
None => return Err(de::Error::invalid_length(3, &"Automaton expects 5 elements")),
None => {
return Err(de::Error::invalid_length(
3,
&"Automaton expects 5 elements",
))
}
};
let transitions = match seq.next_element::<Vec<BTreeMap<TAlphabet, (State, TOutput)>>>()? {
Some(x) => x,
None => return Err(de::Error::invalid_length(4, &"Automaton expects 5 elements")),
None => {
return Err(de::Error::invalid_length(
4,
&"Automaton expects 5 elements",
))
}
};
let automata = Automaton {

View File

@@ -23,7 +23,9 @@ pub fn derive_span(input: &DeriveInput) -> Result<impl quote::ToTokens> {
}
}
}
syn::Data::Union(_) => panic!("derive(Ast) can only be used with structs and enums, not unions"),
syn::Data::Union(_) => {
panic!("derive(Ast) can only be used with structs and enums, not unions")
}
};
let generics = add_span_trait_bounds(input.generics.clone());