-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libsyntax: cleanup and refactor pat.rs
#63490
Conversation
(I started writing up this PR before the note in #63469 (comment) but I'm happy to wait for moving things around.) |
I personally don't extract code into functions unless they are called at least twice or take a whole page of text, so I'd rather back out a half of the "extract" commits. |
Which ones would you like to keep?
Heh; I personally think (and imo this is conventional SE thinking) that large methods forces you to hold more state in your head, that they obscure the overall structure re. the "big picture" ( |
I don't want to argue about this too much, it still looks ok, in particular because every match arm in parse_pat is moved into a separate function (something I didn't notice in commit by commit reading), even if the resulting functions sometimes look like @bors r+ |
📌 Commit c8fc4c1 has been approved by |
…chenkov libsyntax: cleanup and refactor `pat.rs` A smaller refactoring & cleanup of `pat.rs` (best read commit by commit). r? @petrochenkov
…chenkov libsyntax: cleanup and refactor `pat.rs` A smaller refactoring & cleanup of `pat.rs` (best read commit by commit). r? @petrochenkov
…chenkov libsyntax: cleanup and refactor `pat.rs` A smaller refactoring & cleanup of `pat.rs` (best read commit by commit). r? @petrochenkov
Rollup of 10 pull requests Successful merges: - #62984 (Add lint for excess trailing semicolons) - #63075 (Miri: Check that a ptr is aligned and inbounds already when evaluating `*`) - #63490 (libsyntax: cleanup and refactor `pat.rs`) - #63495 ( Remove redundant `ty` fields from `mir::Constant` and `hair::pattern::PatternRange`.) - #63509 (Point at the right enclosing scope when using `await` in non-async fn) - #63528 (syntax: Remove `DummyResult::expr_only`) - #63534 (Bump to 1.39) - #63537 (expand: Unimplement `MutVisitor` on `MacroExpander`) - #63542 (Add NodeId for Arm, Field and FieldPat) - #63560 (move test that shouldn't be in test/run-pass/) Failed merges: r? @ghost
…chenkov libsyntax: cleanup and refactor `pat.rs` A smaller refactoring & cleanup of `pat.rs` (best read commit by commit). r? @petrochenkov
…chenkov libsyntax: cleanup and refactor `pat.rs` A smaller refactoring & cleanup of `pat.rs` (best read commit by commit). r? @petrochenkov
Rollup of 11 pull requests Successful merges: - #62984 (Add lint for excess trailing semicolons) - #63075 (Miri: Check that a ptr is aligned and inbounds already when evaluating `*`) - #63490 (libsyntax: cleanup and refactor `pat.rs`) - #63507 (When needing type annotations in local bindings, account for impl Trait and closures) - #63509 (Point at the right enclosing scope when using `await` in non-async fn) - #63528 (syntax: Remove `DummyResult::expr_only`) - #63537 (expand: Unimplement `MutVisitor` on `MacroExpander`) - #63542 (Add NodeId for Arm, Field and FieldPat) - #63543 (Merge Variant and Variant_) - #63560 (move test that shouldn't be in test/run-pass/) - #63570 (Adjust tracking issues for `MaybeUninit<T>` gates) Failed merges: r? @ghost
🎉 |
A smaller refactoring & cleanup of
pat.rs
(best read commit by commit).r? @petrochenkov