From fd4f08e75f6dd68a629fd4ac0d6375b6a0930446 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Fri, 8 May 2020 12:24:53 -0700 Subject: [PATCH] peepmatic: rustfmt --- .../crates/automata/src/serde_impls.rs | 35 ++++++++++++++++--- cranelift/peepmatic/crates/macro/src/span.rs | 4 ++- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/cranelift/peepmatic/crates/automata/src/serde_impls.rs b/cranelift/peepmatic/crates/automata/src/serde_impls.rs index f7543626e5..8a5d79214f 100644 --- a/cranelift/peepmatic/crates/automata/src/serde_impls.rs +++ b/cranelift/peepmatic/crates/automata/src/serde_impls.rs @@ -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::>()? { 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::()? { 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::>>()? { 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::>>()? { 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 { diff --git a/cranelift/peepmatic/crates/macro/src/span.rs b/cranelift/peepmatic/crates/macro/src/span.rs index f994920dff..bdc0a63655 100644 --- a/cranelift/peepmatic/crates/macro/src/span.rs +++ b/cranelift/peepmatic/crates/macro/src/span.rs @@ -23,7 +23,9 @@ pub fn derive_span(input: &DeriveInput) -> Result { } } } - 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());