-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Rustdoc should show output of examples #12496
Comments
cc @alexcrichton, @cmr |
I'm a little confused, what's an example of what you're thinking about? Are you thinking that you can mouse-over to see the output? Rustdoc should inject the output? |
The example on let mut path = Path::new("/tmp/path");
println!("path: {}", path.display());
path.set_filename("foo");
path.push("bar");
println!("new path: {}", path.display());
println!("path exists: {}", path.exists()); Output
Mouse-over vs. including it directly etc. can be decided by someone else. There's also been a suggestion of having editable/runnable examples in the tutorial (etc.) using a sandbox similar to the one IRC-rusti has; we could possibly do something similar for docs which would solve this (but then our docs are reliant on a rustc backend to see everything, not standalone). |
There are two separate issues here: one is just making available the output of all examples, and the other is providing a tool with which authors can insert code blocks that contain the output of examples. |
I like linking to the sandbox rather than printing it out. |
I agree, I think the sandbox is a lot more valuable and simple here. Do you agree, @huonw? |
I think the existence of the sandbox and that all code examples now linking to it closes this. |
Disable `cast_lossless` when casting to u128 from any (u)int type Fixes rust-lang/rust-clippy#12492 Disables `cast_lossless` when casting to u128 from any int or uint type. The lint states that when casting to any int type, there can potentially be lossy behaviour if the source type ever exceeds the size of the destination type in the future, which is impossible with a destination of u128. It's possible this is a bit of a niche edge case which is better addressed by just disabling the lint in code, but I personally couldn't think of any good reason to still lint in this specific case - maybe except if the source is a bool, for readability reasons :). changelog: FP: `cast_lossless`: disable lint when casting to u128 from any (u)int type
Lint casts to `u128` in `cast_lossless` Reverts rust-lang#12496 per https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Should.20.60as.20u128.60.20trigger.20cast_lossless Also changes the lint messages and refactors the suggestion production - Fixes rust-lang#12695 changelog: [`cast_lossless`]: lint casts to `u128`
e.g.
std::path
has an example thatprintln!
's 3 things, but the user has to copy-paste and then wrap it infn main() {}
to actually see them.The text was updated successfully, but these errors were encountered: