-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #43008 - zackmdavis:field_init_shorthand_in_librustc, r…
…=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,`)
- Loading branch information
Showing
62 changed files
with
374 additions
and
374 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,8 +36,8 @@ impl DepGraphQuery { | |
} | ||
|
||
DepGraphQuery { | ||
graph: graph, | ||
indices: indices | ||
graph, | ||
indices, | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.