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

Standardize on self-containedness of examples in docs. #688

Closed
steveklabnik opened this issue Jan 21, 2015 · 1 comment
Closed

Standardize on self-containedness of examples in docs. #688

steveklabnik opened this issue Jan 21, 2015 · 1 comment
Labels
T-doc Relevant to the documentation team, which will review and decide on the RFC.

Comments

@steveklabnik
Copy link
Member

Issue by huonw
Sunday Sep 22, 2013 at 07:49 GMT

For earlier discussion, see rust-lang/rust#9403

This issue was labelled with: A-docs, B-RFC in the Rust repository


There are many examples in the docs that require some adjustments to get to compile, e.g. the following requires a main function:

let a = [0];
let b = [1];
let mut it = a.iter().chain(b.iter());
assert_eq!(it.next().get(), &0);
assert_eq!(it.next().get(), &1);
assert!(it.next().is_none());

(Iterator.chain at the time of filing.)

And others that are entirely self-contained, and can just be copy-pasted to be run.

use std::rand;

fn main () {
    let tuple_ptr = rand::random::<~(f64, char)>();
    printfln!(tuple_ptr)
}

(One of the examples at the top of std::rand.)

It seems like it would be good to be consistent about this. I prefer the latter, and it would make automatically running the tests much easier (#2925).

@petrochenkov petrochenkov added the T-doc Relevant to the documentation team, which will review and decide on the RFC. label Jan 19, 2018
@Centril
Copy link
Contributor

Centril commented Oct 7, 2018

@Centril Centril closed this as completed Oct 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-doc Relevant to the documentation team, which will review and decide on the RFC.
Projects
None yet
Development

No branches or pull requests

3 participants