run cargo fmt

This commit is contained in:
Kartavya Vashishtha 2022-11-19 15:08:32 +05:30
parent a3f8fd71df
commit 6d4b2b4b17
No known key found for this signature in database
GPG key ID: A50012C2324E5DF0

View file

@ -103,12 +103,12 @@ pub fn parse_format_exprs(input: &str) -> Result<(String, Vec<Arg>), ()> {
output.push(chr); output.push(chr);
extracted_expressions.push(Arg::Placeholder); extracted_expressions.push(Arg::Placeholder);
state = State::NotArg; state = State::NotArg;
}, }
(State::MaybeArg, ':') => { (State::MaybeArg, ':') => {
output.push(chr); output.push(chr);
extracted_expressions.push(Arg::Placeholder); extracted_expressions.push(Arg::Placeholder);
state = State::FormatOpts; state = State::FormatOpts;
}, }
(State::MaybeArg, _) => { (State::MaybeArg, _) => {
if matches!(chr, '\\' | '$') { if matches!(chr, '\\' | '$') {
current_expr.push('\\'); current_expr.push('\\');
@ -122,13 +122,13 @@ pub fn parse_format_exprs(input: &str) -> Result<(String, Vec<Arg>), ()> {
} else { } else {
state = State::Expr; state = State::Expr;
} }
}, }
(State::Ident | State::Expr, ':') if matches!(chars.peek(), Some(':')) => { (State::Ident | State::Expr, ':') if matches!(chars.peek(), Some(':')) => {
// path separator // path separator
state = State::Expr; state = State::Expr;
current_expr.push_str("::"); current_expr.push_str("::");
chars.next(); chars.next();
}, }
(State::Ident | State::Expr, ':' | '}') => { (State::Ident | State::Expr, ':' | '}') => {
if inexpr_open_count == 0 { if inexpr_open_count == 0 {
let trimmed = current_expr.trim(); let trimmed = current_expr.trim();
@ -146,7 +146,13 @@ pub fn parse_format_exprs(input: &str) -> Result<(String, Vec<Arg>), ()> {
output.push(chr); output.push(chr);
current_expr.clear(); current_expr.clear();
state = if chr == ':' {State::FormatOpts} else if chr == '}' {State::NotArg} else {unreachable!()}; state = if chr == ':' {
State::FormatOpts
} else if chr == '}' {
State::NotArg
} else {
unreachable!()
};
} else if chr == '}' { } else if chr == '}' {
// We're closing one brace met before inside of the expression. // We're closing one brace met before inside of the expression.
current_expr.push(chr); current_expr.push(chr);
@ -155,7 +161,7 @@ pub fn parse_format_exprs(input: &str) -> Result<(String, Vec<Arg>), ()> {
// We're inside of braced expression, assume that it's a struct field name/value delimiter. // We're inside of braced expression, assume that it's a struct field name/value delimiter.
current_expr.push(chr); current_expr.push(chr);
} }
}, }
(State::Ident | State::Expr, '{') => { (State::Ident | State::Expr, '{') => {
state = State::Expr; state = State::Expr;
current_expr.push(chr); current_expr.push(chr);