Skip to content

Extend examples for AtomicBool::{swap, compare_and_swap} #26177

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

Merged
merged 1 commit into from
Jun 11, 2015

Conversation

jooert
Copy link
Contributor

@jooert jooert commented Jun 10, 2015

Closes #26169.

r? @steveklabnik

@@ -285,7 +286,8 @@ impl AtomicBool {
///
/// let some_bool = AtomicBool::new(true);
///
/// let value = some_bool.store(false, Ordering::Relaxed);
/// assert_eq!(true, some_bool.compare_and_swap(false, false, Ordering::Relaxed));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this also perhaps show off an example of a successful compare-and-swap? Also, our assertions are typically assert_eq!(actual, expected) instead of the other way around I believe.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer assert_eq!(actual, expected) as well, but all other examples for AtomicBool used assert_eq!(expected, actual) and I wanted to stay consistent. Should I swap the arguments of all other asserts in this file as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

Swap arguments of `assert_eq!` calls, insert additional assertions
here and there.
Closes rust-lang#26169.
@jooert
Copy link
Contributor Author

jooert commented Jun 10, 2015

Added successful compare_and_swap examples, changed order of arguments when calling assert_eq! and added some additional assertions in other examples.

@alexcrichton
Copy link
Member

@bors: r+ 5c9f069

Thanks!

@bors
Copy link
Collaborator

bors commented Jun 11, 2015

⌛ Testing commit 5c9f069 with merge 7e9a8e3...

bors added a commit that referenced this pull request Jun 11, 2015
@bors bors merged commit 5c9f069 into rust-lang:master Jun 11, 2015
@jooert jooert deleted the fix26169 branch June 11, 2015 13:18
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