-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
BTreeMap: refactor Entry out of map.rs into its own file #77851
Conversation
btree/map.rs is approaching the 3000 line mark, splitting out the entry code buys about 500 lines of headroom
r? @dtolnay (rust_highfive has picked a reviewer for you, use r? to override) |
use super::super::node::{marker, Handle, InsertResult::*, NodeRef}; | ||
use super::BTreeMap; | ||
|
||
use Entry::*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make it more explicit and not use use Entry::*
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, in this file I think it's pretty clear that Vacant
and Occupied
are variants of Entry
. I don't think adding Entry::
in front of them is really worth it.
In map.rs
it may make more sense to remove the glob import, given that there's only 2 uses each of the unqualified variant names
r? @ssomers |
That 3000 limit can easily be ignored, and map.rs was much longer not too long ago. But it is unwieldly. I moved the Separating off |
Actually, I changed my mind. It builds with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@bors r+ |
📌 Commit 4b96049 has been approved by |
BTreeMap: refactor Entry out of map.rs into its own file btree/map.rs is approaching the 3000 line mark, splitting out the entry code buys about 500 lines of headroom. I've created this PR because the changes I've made in rust-lang#77438 will push `map.rs` over the 3000 line limit and cause tidy to complain. I picked `Entry` to factor out because it feels less tightly coupled to the rest of `BTreeMap` than the various iterator implementations. Related: rust-lang#60302
BTreeMap: refactor Entry out of map.rs into its own file btree/map.rs is approaching the 3000 line mark, splitting out the entry code buys about 500 lines of headroom. I've created this PR because the changes I've made in rust-lang#77438 will push `map.rs` over the 3000 line limit and cause tidy to complain. I picked `Entry` to factor out because it feels less tightly coupled to the rest of `BTreeMap` than the various iterator implementations. Related: rust-lang#60302
Failed in https://github.com/rust-lang-ci/rust/runs/1266196319 (clippy test):
Here's the test: https://github.com/rust-lang/rust-clippy/blob/master/tests/ui/or_fun_call.rs I guess we cannot find |
I'm inclined to think it's wrong. The 3rd and 4th error have nothing to do with btree, and when I try to invoke BTreeMap's |
@ssomers Hmm, but the test with |
Indeed. The path to the Entry struct is hardcoded as BTREEMAP_ENTRY in src/tools/clippy/clippy_lints/src/utils/paths.rs. |
c2fa4cc
to
3e2121c
Compare
I believe I've fixed the failing clippy test, thanks @ssomers for pointing out the hardcoded path. r? @JohnTitor |
@bors r=dtolnay rollup=iffy |
📌 Commit 3e2121c has been approved by |
Confirmed this passes the clippy test, thanks! |
Rollup of 7 pull requests Successful merges: - rust-lang#75802 (resolve: Do not put nonexistent crate `meta` into prelude) - rust-lang#76607 (Modify executable checking to be more universal) - rust-lang#77851 (BTreeMap: refactor Entry out of map.rs into its own file) - rust-lang#78043 (Fix grammar in note for orphan-rule error [E0210]) - rust-lang#78048 (Suggest correct place to add `self` parameter when inside closure) - rust-lang#78050 (Small CSS cleanup) - rust-lang#78059 (Set `MDBOOK_OUTPUT__HTML__INPUT_404` on linkchecker) Failed merges: r? `@ghost`
BTreeMap: split off most code of remove and split_off Putting map.rs on a diet, in addition to rust-lang#77851. r? @dtolnay
BTreeMap: split off most code of remove and split_off Putting map.rs on a diet, in addition to rust-lang#77851. r? @dtolnay
BTreeMap: refactor Entry out of map.rs into its own file btree/map.rs is approaching the 3000 line mark, splitting out the entry code buys about 500 lines of headroom. I've created this PR because the changes I've made in rust-lang#77438 will push `map.rs` over the 3000 line limit and cause tidy to complain. I picked `Entry` to factor out because it feels less tightly coupled to the rest of `BTreeMap` than the various iterator implementations. Related: rust-lang#60302
btree/map.rs is approaching the 3000 line mark, splitting out the entry
code buys about 500 lines of headroom.
I've created this PR because the changes I've made in #77438 will push
map.rs
over the 3000 line limit and cause tidy to complain.I picked
Entry
to factor out because it feels less tightly coupled to the rest ofBTreeMap
than the various iterator implementations.Related: #60302