diff options
| author | Kartavya Vashishtha <sendtokartavya@gmail.com> | 2022-11-19 15:08:32 +0530 |
|---|---|---|
| committer | Kartavya Vashishtha <sendtokartavya@gmail.com> | 2022-11-19 15:08:32 +0530 |
| commit | 6d4b2b4b17841cdb29e99bf7e7e71b57dbaa2dc1 (patch) | |
| tree | 743e6a1cb063d63332a4605b241ead54a47326ae | |
| parent | a3f8fd71df0e09b6cd161a7e7df78c67bb47d329 (diff) | |
| download | rust-6d4b2b4b17841cdb29e99bf7e7e71b57dbaa2dc1.tar.gz rust-6d4b2b4b17841cdb29e99bf7e7e71b57dbaa2dc1.zip | |
run cargo fmt
| -rw-r--r-- | crates/ide-db/src/syntax_helpers/format_string_exprs.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/crates/ide-db/src/syntax_helpers/format_string_exprs.rs b/crates/ide-db/src/syntax_helpers/format_string_exprs.rs index c3b7bb27d88..313346ee131 100644 --- a/crates/ide-db/src/syntax_helpers/format_string_exprs.rs +++ b/crates/ide-db/src/syntax_helpers/format_string_exprs.rs @@ -103,12 +103,12 @@ pub fn parse_format_exprs(input: &str) -> Result<(String, Vec<Arg>), ()> { output.push(chr); extracted_expressions.push(Arg::Placeholder); state = State::NotArg; - }, + } (State::MaybeArg, ':') => { output.push(chr); extracted_expressions.push(Arg::Placeholder); state = State::FormatOpts; - }, + } (State::MaybeArg, _) => { if matches!(chr, '\\' | '$') { current_expr.push('\\'); @@ -122,13 +122,13 @@ pub fn parse_format_exprs(input: &str) -> Result<(String, Vec<Arg>), ()> { } else { state = State::Expr; } - }, + } (State::Ident | State::Expr, ':') if matches!(chars.peek(), Some(':')) => { // path separator state = State::Expr; current_expr.push_str("::"); chars.next(); - }, + } (State::Ident | State::Expr, ':' | '}') => { if inexpr_open_count == 0 { let trimmed = current_expr.trim(); @@ -146,7 +146,13 @@ pub fn parse_format_exprs(input: &str) -> Result<(String, Vec<Arg>), ()> { output.push(chr); 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 == '}' { // We're closing one brace met before inside of the expression. 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. current_expr.push(chr); } - }, + } (State::Ident | State::Expr, '{') => { state = State::Expr; current_expr.push(chr); |
