Skip to content

The default_stat fn should be public #9637

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

Closed
wants to merge 1 commit into from

Conversation

MicahChalmer
Copy link
Contributor

Anybody working with a C API that uses the stat structure will want default_stat to be accessible, since, as can be seen by the implementation of default_stat, all uses of stat without it would need to be platform-specific.

In this PR I have simply made it public--I would understand if there was a desire to put the public API somewhere else instead. (There is no reason it should be in std::path.) Maybe an impl of Default in std::libc itself?

@alexcrichton
Copy link
Member

This seems like a good candidate for using a re-export instead of having to reach all the way into std::path::stat::arch::default_stat.

@huonw
Copy link
Member

huonw commented Oct 1, 2013

I also imagine that @kballard's upcoming path rewrite will obsolete this(?).

@lilyball
Copy link
Contributor

lilyball commented Oct 1, 2013

No, I copied the stat modules as-is into the new Path. I figure they can be rewritten later.

However, I don't think that we should make default_stat() public. Instead, stat should implement the Default trait (could even be derived, since all the fields should be 0). I already filed this as #9537.

@MicahChalmer
Copy link
Contributor Author

I submitted a new pull request (#9652) with a version that actually implements Default for stat. For most of the os/architectures I couldn't use Deriving because of the arrays, unfortunately. If that one gets merged, this one can be closed, or vice versa.

@alexcrichton
Copy link
Member

Closing for reasons outlined in #9652

flip1995 pushed a commit to flip1995/rust that referenced this pull request Oct 20, 2022
Add `unused_format_specs` lint

Currently catches two cases:

An empty precision specifier:

```rust
// the same as {}
println!("{:.}", x);
```

And using formatting specs on `format_args!()`:

```rust
// prints `x.`, not `x    .`
println("{:5}.", format_args!("x"));
```

changelog: new lint: [`unused_format_specs`]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants