Skip to content

Commit c19f87a

Browse files
committed
fix: can't compare Option trough assert_eq
1 parent 658e3d3 commit c19f87a

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

library/std/src/macros.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,16 @@ macro_rules! repetition_utils {
412412
/// "key1" => "value1"
413413
/// };
414414
///
415-
/// assert_eq!(map.get("key"), "value");
416-
/// assert_eq!(map.get("key1"), "value1");
415+
/// assert_eq!(
416+
/// map.get("key")
417+
/// .expect("Key to be associated to a value"),
418+
/// "value"
419+
/// );
420+
/// assert_eq!(
421+
/// map.get("key1")
422+
/// .expect("Key to be associated to a value"),
423+
/// "value1"
424+
/// );
417425
/// ```
418426
///
419427
/// This macro also supports trailing comma.
@@ -425,7 +433,11 @@ macro_rules! repetition_utils {
425433
/// "key" => "value", // notice the ,
426434
/// };
427435
///
428-
/// assert_eq!(map.get("key"), "value");
436+
/// assert_eq!(
437+
/// map.get("key")
438+
/// .expect("Key to be associated to a value"),
439+
/// "value"
440+
/// );
429441
/// ```
430442
///
431443
/// The key and value are moved into the HashMap.

0 commit comments

Comments
 (0)