-
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
Remove sys::args::Args::inner_debug
and use Debug
instead
#84413
Conversation
r? @m-ou-se (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
17080ca
to
6da27a9
Compare
The |
library/std/src/env.rs
Outdated
@@ -799,7 +799,7 @@ impl DoubleEndedIterator for Args { | |||
#[stable(feature = "std_debug", since = "1.16.0")] | |||
impl fmt::Debug for Args { | |||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |||
f.debug_struct("Args").field("inner", &self.inner.inner.inner_debug()).finish() | |||
f.debug_struct("Args").field("inner", &format_args!("{:?}", self.inner.inner)).finish() |
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.
Why the format_args
instead of just passing &self.inner.inner
to field()
?
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.
That's better, I forgot field
already takes &dyn Debug
.
Even with the |
6da27a9
to
1a6de84
Compare
Yes, those also produce the same result: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=dbe3d60846cf29e0f4d51f85c6012bfa |
They gave different output with the |
@bors r+ |
📌 Commit 1a6de84 has been approved by |
Rollup of 7 pull requests Successful merges: - rust-lang#84343 (Remove `ScopeTree::closure_tree`) - rust-lang#84376 (Uses flex to fix formatting of h1 at any width) - rust-lang#84377 (Followup to rust-lang#83944) - rust-lang#84396 (Update LLVM submodule) - rust-lang#84402 (Move `sys_common::rwlock::StaticRWLock` etc. to `sys::unix::rwlock`) - rust-lang#84404 (Check for intrinsics before coercing to a function pointer) - rust-lang#84413 (Remove `sys::args::Args::inner_debug` and use `Debug` instead) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This removes the method
sys::args::Args::inner_debug
on all platforms and implementsDebug
forArgs
instead.I believe this creates a more natural API for the different platforms under
sys
: export a typeArgs: Debug + Iterator + ...
vs.Args: Iterator + ...
and with a methodinner_debug
.