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

[tock-cells] Fix unit tests embedded in rustdocs #1099

Merged
merged 2 commits into from
Jul 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ alldoc:
.PHONY: ci-travis
ci-travis:
@CI=true ./tools/run_cargo_fmt.sh diff
@CI=true cd libraries/tock-cells && cargo test
@CI=true make allboards
@CI=true make -C boards/nordic/nrf52dk debug
@CI=true tools/toc.sh
Expand Down
8 changes: 7 additions & 1 deletion libraries/tock-cells/src/map_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ impl<T> MapCell<T> {
/// # Examples
///
/// ```
/// extern crate tock_cells;
/// use tock_cells::map_cell::MapCell;
///
/// let cell = MapCell::new(1234);
/// let x = &cell;
/// let y = &cell;
Expand Down Expand Up @@ -88,13 +91,16 @@ impl<T> MapCell<T> {
/// # Examples
///
/// ```
/// extern crate tock_cells;
/// use tock_cells::map_cell::MapCell;
///
/// let cell = MapCell::new(1234);
/// let x = &cell;
/// let y = &cell;
///
/// x.map(|value| {
/// // We have mutable access to the value while in the closure
/// value += 1;
/// *value += 1;
/// });
///
/// // After the closure completes, the mutable memory is still in the cell,
Expand Down
3 changes: 2 additions & 1 deletion libraries/tock-cells/src/numeric_cell_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
//! To use these traits, simply pull them into scope:
//!
//! ```rust
//! use kernel::common::cells::numeric_cell_ext;
//! extern crate tock_cells;
//! use tock_cells::numeric_cell_ext::NumericCellExt;
//! ```

use core::cell::Cell;
Expand Down
8 changes: 6 additions & 2 deletions libraries/tock-cells/src/take_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ impl<'a, T: ?Sized> TakeCell<'a, T> {
/// # Examples
///
/// ```
/// use kernel::common::cells::TakeCell;
/// extern crate tock_cells;
/// use tock_cells::take_cell::TakeCell;
///
/// let mut value = 1234;
/// let cell = TakeCell::new(&mut value);
/// let x = &cell;
Expand Down Expand Up @@ -88,7 +90,9 @@ impl<'a, T: ?Sized> TakeCell<'a, T> {
/// # Examples
///
/// ```
/// use kernel::common::cells::TakeCell;
/// extern crate tock_cells;
/// use tock_cells::take_cell::TakeCell;
///
/// let mut value = 1234;
/// let cell = TakeCell::new(&mut value);
/// let x = &cell;
Expand Down