Uh oh!
There was an error while loading. Please reload this page.
use field init shorthand in src/librustc/ - #43008
Conversation
rust-highfive
commented
Jul 1, 2017
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
zackmdavis
commented
Jul 1, 2017
(haven't built this locally, it being convenient to just let our friend Travis decide if this actually works) |
There was a problem hiding this comment.
hm, yes, regex should've probably been (\w+): \1,?\n rather than (\w+): \1,
Mark-Simulacrum
commented
Jul 2, 2017
Is there a reason this is limited to just librustc? It seems appropriate to either run this everywhere or nowhere. |
zackmdavis
commented
Jul 2, 2017
It seemed less "dramatic", and less likely to collide with other PRs? Maybe that's not very compelling. |
Mark-Simulacrum
commented
Jul 2, 2017
I'm happy with starting with just librustc and then expanding to others. |
377425d to
83d5fbfComparezackmdavis
commented
Jul 3, 2017
(Travis passed on the initial submission; I've added a newline to the regex (to catch cases like the one Tim points out), reapplied (on master), and force-pushed.) |
PlasmaPower
commented
Jul 4, 2017
Quick shell command to do the same thing as the Python version:
If you want to specify a directory, put it right after the |
estebank
commented
Jul 5, 2017
@bors try |
bors
commented
Jul 5, 2017
…=<try> use field init shorthand in src/librustc/ Commentary on #37340 [suggested](#37340 (comment)) using the new field init syntax in the compiler. Do we care about this? If so, here's a pull request for the librustc/ directory. While [`rustfmt` might do this in the future](#37340 (comment)), in the meantime, some simple Python will do: ```python #!/usr/bin/env python3 import os, re, sys OPPORTUNITY = re.compile(r" (\w+): \1,?\n") def field_init_shorthand_substitution(filename): with open(filename) as f: text = f.read() revised = OPPORTUNITY.sub(r" \1,\n", text) with open(filename, 'w') as f: f.write(revised) def substitute_in_directory(path): for dirname, _subdirs, basenames in os.walk(path): for basename in basenames: field_init_shorthand_substitution(os.path.join(dirname, basename)) if __name__ == "__main__": substitute_in_directory(sys.argv[1]) ``` **Update 3 July**: edited the search (respectively replace) regex to ` (\w+): \1,?\n` (` \1,\n`) from ` (\w+): \1,` (` \1,`)
bors
commented
Jul 6, 2017
☀️ Test successful - status-travis |
estebank
commented
Jul 6, 2017
@bors r+ |
bors
commented
Jul 6, 2017
📌 Commit 83d5fbf has been approved by |
Mark-Simulacrum
commented
Jul 6, 2017
For the record, try builds should not be used except to obtain artifacts for cargobomb -- they don't actually test much more than the standard PR builder (just dist, I think). |
estebank
commented
Jul 6, 2017
@Mark-Simulacrum thanks for the clarification! Going forward, should I just r+ and let travis catch any issues then? |
alexcrichton
commented
Jul 6, 2017
@bors: retry |
1 similar comment
alexcrichton
commented
Jul 6, 2017
@bors: retry |
bors
commented
Jul 6, 2017
🔒 Merge conflict |
The field init shorthand syntax was stabilized in 1.17.0 (aebd94f); we are now free to use it in the compiler.
83d5fbf to
f668999Comparezackmdavis
commented
Jul 6, 2017
I don't understand why Git seems to think master's deletion of the libcompiler_builtins directory is a merge conflict? Anyway, rebased and force-pushed. |
estebank
commented
Jul 6, 2017
@bors r+ |
bors
commented
Jul 6, 2017
📌 Commit f668999 has been approved by |
bors
commented
Jul 6, 2017
…=estebank use field init shorthand in src/librustc/ Commentary on #37340 [suggested](#37340 (comment)) using the new field init syntax in the compiler. Do we care about this? If so, here's a pull request for the librustc/ directory. While [`rustfmt` might do this in the future](#37340 (comment)), in the meantime, some simple Python will do: ```python #!/usr/bin/env python3 import os, re, sys OPPORTUNITY = re.compile(r" (\w+): \1,?\n") def field_init_shorthand_substitution(filename): with open(filename) as f: text = f.read() revised = OPPORTUNITY.sub(r" \1,\n", text) with open(filename, 'w') as f: f.write(revised) def substitute_in_directory(path): for dirname, _subdirs, basenames in os.walk(path): for basename in basenames: field_init_shorthand_substitution(os.path.join(dirname, basename)) if __name__ == "__main__": substitute_in_directory(sys.argv[1]) ``` **Update 3 July**: edited the search (respectively replace) regex to ` (\w+): \1,?\n` (` \1,\n`) from ` (\w+): \1,` (` \1,`)
bors
commented
Jul 6, 2017
☀️ Test successful - status-appveyor, status-travis |
Like rust-lang#43008 (f668999), but _much more aggressive_.
…Mark-Simulacrum use field init shorthand EVERYWHERE Like #43008 (f668999), but [(lacking reasons to be more timid)](#43008 (comment)) _much more aggressive_. r? @Mark-Simulacrum
…Mark-Simulacrum use field init shorthand EVERYWHERE Like #43008 (f668999), but [(lacking reasons to be more timid)](rust-lang/rust#43008 (comment)) _much more aggressive_. r? @Mark-Simulacrum
Commentary on #37340suggested using the new field init syntax in the compiler. Do we care about this? If so, here's a pull request for the librustc/ directory. While
rustfmtmight do this in the future, in the meantime, some simple Python will do:Update 3 July: edited the search (respectively replace) regex to
(\w+): \1,?\n(\1,\n) from(\w+): \1,(\1,)