Skip to content

Commit

Permalink
fix: lint error in rustdoc example
Browse files Browse the repository at this point in the history
  • Loading branch information
snormore committed Apr 27, 2024
1 parent c413863 commit e9150c4
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,22 @@
//! use owned_ref_cell::OwnedRefCell;
//! use std::collections::HashMap;
//!
//! fn main() {
//! let shared_map = OwnedRefCell::new(HashMap::new());
//! let shared_map = OwnedRefCell::new(HashMap::new());
//!
//! // Create a new block to limit the scope of the dynamic borrow
//! {
//! let mut map = shared_map.borrow_mut();
//! map.insert("green", 92388);
//! map.insert("blue", 11837);
//! map.insert("red", 11826);
//! map.insert("yellow", 38);
//! }
//!
//! // Note that if we had not let the previous borrow of the cache fall out
//! // of scope then the subsequent borrow would cause a dynamic thread panic.
//! // This is the major hazard of using `RefCell`.
//! let total: i32 = shared_map.borrow().values().sum();
//! assert_eq!(total, 116089);
//! // Create a new block to limit the scope of the dynamic borrow
//! {
//! let mut map = shared_map.borrow_mut();
//! map.insert("green", 92388);
//! map.insert("blue", 11837);
//! map.insert("red", 11826);
//! map.insert("yellow", 38);
//! }
//!
//! // Note that if we had not let the previous borrow of the cache fall out
//! // of scope then the subsequent borrow would cause a dynamic thread panic.
//! // This is the major hazard of using `RefCell`.
//! let total: i32 = shared_map.borrow().values().sum();
//! assert_eq!(total, 116089);
//! ```
//!
//! This module also provides:
Expand Down

0 comments on commit e9150c4

Please sign in to comment.