Skip to content

Define and use a print_maybe_styled! macro in libsyntax/diagnostic.rs - #26846

Merged
bors merged 1 commit into
rust-lang:masterfrom
ftxqxd:print-maybe-styled-macro
Jul 29, 2015
Merged

Define and use a print_maybe_styled! macro in libsyntax/diagnostic.rs #26846
bors merged 1 commit into
rust-lang:masterfrom
ftxqxd:print-maybe-styled-macro

Conversation

@ftxqxd

Copy link
Copy Markdown
Contributor

EmitterWriter::print_maybe_styled was basically always used with format!, so this macro makes some code cleaner. It should also remove some unnecessary allocations (most print_maybe_styled invocations allocated a String previously, whereas the new macro uses write_fmt to write the formatted string directly to the terminal).

This probably could have been part of #26838, but it’s too late now. It’s also rebased on #26838’s branch because otherwise pretty much all of the changes in this PR would conflict with the other PR’s changes.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @pnkfelix

(rust_highfive has picked a reviewer for you, use r? to override)

@bors

bors commented Jul 17, 2015

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #27066) made this pull request unmergeable. Please resolve the merge conflicts.

@pnkfelix

Copy link
Copy Markdown
Contributor

This seems basically fine, r=me after the rebase.

`EmitterWriter::print_maybe_styled` was basically always used with `format!`, so
this macro makes some code cleaner. It should also remove some unnecessary
allocations (most `print_maybe_styled` invocations allocated a `String`
previously, whereas the new macro uses `write_fmt` to write the formatted string
directly to the terminal).
This probably could have been part of rust-lang#26838, but it’s too late now.
@ftxqxd
ftxqxdforce-pushed the print-maybe-styled-macro branch from aa75c67 to 3ebf706CompareJuly 18, 2015 01:12
@ftxqxd

Copy link
Copy Markdown
ContributorAuthor

Rebased.

@ftxqxd

Copy link
Copy Markdown
ContributorAuthor

@pnkfelix Ping

@pnkfelix

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jul 28, 2015

Copy link
Copy Markdown
Collaborator

📌 Commit 3ebf706 has been approved by pnkfelix

@bors

bors commented Jul 29, 2015

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 3ebf706 with merge 8d432fb...

bors added a commit that referenced this pull request Jul 29, 2015
`EmitterWriter::print_maybe_styled` was basically always used with `format!`, so this macro makes some code cleaner. It should also remove some unnecessary allocations (most `print_maybe_styled` invocations allocated a `String` previously, whereas the new macro uses `write_fmt` to write the formatted string directly to the terminal).
This probably could have been part of #26838, but it’s too late now. It’s also rebased on #26838’s branch because otherwise pretty much all of the changes in this PR would conflict with the other PR’s changes.
@bors
bors merged commit 3ebf706 into rust-lang:masterJul 29, 2015
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@ftxqxd@rust-highfive@bors@pnkfelix