-
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
Stop importing the float modules in documentation #70782
Conversation
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
806aae6
to
28c9231
Compare
@bors r+ |
📌 Commit 28c9231 has been approved by |
Is it possible we could make |
Not that I know of. And probably not currently. But someone with better compiler knowledge can probably give a better answer. Associated constant "modules" would be great. Having |
Btw. Are not all the I see there have been previous arguments about the naming of these constants. So given that the names are not perfect and have a hard time conveying exactly what they mean, I personally think This is of course not really relevant to this PR. But my point is that if these constants are indeed pointless it means that the only mathematical constants with any value are |
Rollup of 7 pull requests Successful merges: - rust-lang#70553 (move OS constants to platform crate) - rust-lang#70665 (Do not lose or reorder user-provided linker arguments) - rust-lang#70750 (Match options directly in the Fuse implementation) - rust-lang#70782 (Stop importing the float modules in documentation) - rust-lang#70798 ("cannot resolve" → "cannot satisfy") - rust-lang#70808 (Simplify dtor registration for HermitCore by using a list of destructors) - rust-lang#70824 (Remove marker comments in libstd/lib.rs macro imports) Failed merges: r? @ghost
Use assoc int and float consts instead of module level ones changelog: Recommend primitive type associated constants instead of module level constants In Rust 1.43 integer and float primitive types will have a number of new associated constants. For example `MAX`, `MIN` and a number of constants related to the machine representation of floats. rust-lang/rust#68952 These new constants are preferred over the module level constants in `{core,std}::{f*, u*, i*}`. I have in the last few days made sure that the documentation in the main rust repository uses the new constants in every place I could find (rust-lang/rust#69860, rust-lang/rust#70782). So the next step is naturally to make the linter recommend the new constants as well. This PR only changes two lints. There are more. But I did not want the PR to be too big. And since I have not contributed to clippy before it felt saner to start with a small PR so I see if there are any quirks. More will come later.
Follow up to #69860. I realized I had not searched for and fixed this for the float values. So with this PR they also use the associated constants instead of the module level constants.
For the documentation where it also was using the
consts
submodule I opted to change it to import that directly. This becomes more in line with how other docs that use theconsts
submodule looks. And it also makes it so there are not twof32
orf64
things in the current namespace (both the module and the primitive type) and then hopefully confusing documentation readers less.r? @dtolnay