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

slice::split_at_mut doc example should demonstrate mutability #44314

Closed
frewsxcv opened this issue Sep 4, 2017 · 5 comments
Closed

slice::split_at_mut doc example should demonstrate mutability #44314

frewsxcv opened this issue Sep 4, 2017 · 5 comments
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. P-low Low priority

Comments

@frewsxcv
Copy link
Member

frewsxcv commented Sep 4, 2017

https://doc.rust-lang.org/std/primitive.slice.html#method.split_at_mut

The doc example should demonstrate the effect of mutation element(s) in the slice

@frewsxcv frewsxcv added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. P-low Low priority A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools labels Sep 4, 2017
@nielsegberts
Copy link
Contributor

Do you mean to add an example like this?

let mut v2 = [1, 0, 3, 0, 5, 6];
{
    let (left, right) = v2.split_at_mut(2);
    left[1] = 2;
    right[1] = 4;
}
assert!(v2 == [1, 2, 3, 4, 5, 6]);

@frewsxcv
Copy link
Member Author

frewsxcv commented Sep 4, 2017

Yep, that looks great!

@nielsegberts
Copy link
Contributor

I'm happy to create a PR to update the documentation.

I think it might be best to move some examples to split_at() and focus on the mutability in split_at_mut().

@frewsxcv
Copy link
Member Author

frewsxcv commented Sep 4, 2017

I'm happy to create a PR to update the documentation.

Go for it 👍

I think it might be best to move some examples to split_at() and focus on the mutability in split_at_mut().

Agreed, sounds good to me

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Sep 6, 2017
Make slice::split_at_mut example demonstrate mutability

Moved the examples from split_at_mut to split_at so the example at
split_at_mut can just demonstrate mutability.

See rust-lang#44314

r? @steveklabnik
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Sep 7, 2017
Make slice::split_at_mut example demonstrate mutability

Moved the examples from split_at_mut to split_at so the example at
split_at_mut can just demonstrate mutability.

See rust-lang#44314

r? @steveklabnik
@frewsxcv
Copy link
Member Author

frewsxcv commented Sep 8, 2017

Fixed in #44325

@frewsxcv frewsxcv closed this as completed Sep 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. P-low Low priority
Projects
None yet
Development

No branches or pull requests

2 participants