-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Idiomatic improvements to IP method #53257
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
Conversation
r? @TimNN (rust_highfive has picked a reviewer for you, use r? to override) |
src/libstd/net/ip.rs
Outdated
(192, 168) => true, | ||
_ => false | ||
match self.octets() { | ||
[10, _..] => true, |
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.
Is [10, _..]
the same as matching [10, ..]
? I would find it clearer that way if the behavior is the same.
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 wrote [10, ..]
first. But the latest release of rustfmt changed it into [10, _..]
so I assumed the latter was the preferred way of writing it 🤷♂️
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.
Seems like a bug in rustfmt. I filed rust-lang/rustfmt#2909 to follow up. I would recommend using ..
in this PR.
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 agree that looks better. Fixed.
@bors r+ rollup |
📌 Commit cbe80a9 has been approved by |
…nt, r=TimNN Idiomatic improvements to IP method Since match ergonomics and slice patterns are stable this might be more idiomatic modern Rust implementations of these methods? Or well, slice patterns with `..` are not stabilized yet, so maybe we want to specify all fields but with `_`?
Rollup of 11 pull requests Successful merges: - #53112 (pretty print BTreeSet) - #53208 (Don't panic on std::env::vars() when env is null.) - #53226 (driver: set the syntax edition in phase 1) - #53229 (Make sure rlimit is only ever increased) - #53233 (targets: aarch64: Add bare-metal aarch64 target) - #53239 (rustc_codegen_llvm: Restore the closure env alloca hack for LLVM 5.) - #53246 (A few cleanups) - #53257 (Idiomatic improvements to IP method) - #53274 (Remove statics field from CodegenCx) - #53290 (Make LLVM emit assembly comments with -Z asm-comments) - #53317 (Mark prior failure to avoid ICE)
Since match ergonomics and slice patterns are stable this might be more idiomatic modern Rust implementations of these methods? Or well, slice patterns with
..
are not stabilized yet, so maybe we want to specify all fields but with_
?