Skip to content
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

internal: use consistent style for error handling #15087

Merged
merged 2 commits into from Jun 19, 2023

Conversation

matklad
Copy link
Member

@matklad matklad commented Jun 19, 2023

No description provided.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 19, 2023
@matklad
Copy link
Member Author

matklad commented Jun 19, 2023

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 19, 2023

📌 Commit 6303551 has been approved by matklad

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jun 19, 2023

⌛ Testing commit 6303551 with merge 0fe5266...

@bors
Copy link
Collaborator

bors commented Jun 19, 2023

☀️ Test successful - checks-actions
Approved by: matklad
Pushing 0fe5266 to master...

@bors bors merged commit 0fe5266 into rust-lang:master Jun 19, 2023
10 checks passed
Comment on lines 292 to 298
impl fmt::Display for VfsPath {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match &self.0 {
VfsPathRepr::PathBuf(it) => fmt::Display::fmt(&it.display(), f),
VfsPathRepr::PathBuf(it) => fmt::Debug::fmt(&it, f),
VfsPathRepr::VirtualPath(VirtualPath(it)) => fmt::Display::fmt(it, f),
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentional? I think fmt::Display::fmt(&it, f) is correct here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh, good catch, this is intentional, but messed up!

In this impl, we want to use Display, in the one below we want to use debug.

that is,

fmt::Debug::fmt(&it.display(),

was actually wrong (this calls display impl, but we do want debug here), but I messed this up.

Could you PR this? :)

@matklad matklad deleted the error-handling branch June 19, 2023 23:04
bors added a commit that referenced this pull request Jun 20, 2023
Fix VfsPath Display and Debug impls

fix #15087 (comment)
r? `@matklad`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants