diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-01-22 12:20:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-22 12:20:23 +0100 |
| commit | e437861d27928751b21af4a2b4bfa52f911da4bb (patch) | |
| tree | 8266f6d84f352e79f8880923af89a861c4f54c57 /src/libsyntax_ext | |
| parent | 70015373b4980fbfa10130de4b0ce041f5b5da8b (diff) | |
| parent | 038d8372244ab088ea186e10704e2bfc4e83f477 (diff) | |
| download | rust-e437861d27928751b21af4a2b4bfa52f911da4bb.tar.gz rust-e437861d27928751b21af4a2b4bfa52f911da4bb.zip | |
Rollup merge of #57537 - sinkuu:fmt_perf, r=alexcrichton
Small perf improvement for fmt Added benchmark is based on #10761
Diffstat (limited to 'src/libsyntax_ext')
| -rw-r--r-- | src/libsyntax_ext/format.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs index 3e3bca7080f..215df4224c5 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -493,7 +493,10 @@ impl<'a, 'b> Context<'a, 'b> { let fill = arg.format.fill.unwrap_or(' '); - if *arg != simple_arg || fill != ' ' { + let pos_simple = + arg.position.index() == simple_arg.position.index(); + + if !pos_simple || arg.format != simple_arg.format || fill != ' ' { self.all_pieces_simple = false; } |
