@@ -502,11 +502,12 @@ impl<T: ?Sized> *const T {
502
502
/// let mut out = String::new();
503
503
/// while ptr != end_rounded_up {
504
504
/// unsafe {
505
- /// write!(&mut out, "{}, ", *ptr).unwrap() ;
505
+ /// write!(&mut out, "{}, ", *ptr)? ;
506
506
/// }
507
507
/// ptr = ptr.wrapping_offset(step);
508
508
/// }
509
509
/// assert_eq!(out.as_str(), "1, 3, 5, ");
510
+ /// # std::fmt::Result::Ok(())
510
511
/// ```
511
512
#[ stable( feature = "ptr_wrapping_offset" , since = "1.16.0" ) ]
512
513
#[ must_use = "returns a new pointer rather than modifying its argument" ]
@@ -1125,11 +1126,12 @@ impl<T: ?Sized> *const T {
1125
1126
/// let mut out = String::new();
1126
1127
/// while ptr != end_rounded_up {
1127
1128
/// unsafe {
1128
- /// write!(&mut out, "{}, ", *ptr).unwrap() ;
1129
+ /// write!(&mut out, "{}, ", *ptr)? ;
1129
1130
/// }
1130
1131
/// ptr = ptr.wrapping_add(step);
1131
1132
/// }
1132
1133
/// assert_eq!(out, "1, 3, 5, ");
1134
+ /// # std::fmt::Result::Ok(())
1133
1135
/// ```
1134
1136
#[ stable( feature = "pointer_methods" , since = "1.26.0" ) ]
1135
1137
#[ must_use = "returns a new pointer rather than modifying its argument" ]
@@ -1203,11 +1205,12 @@ impl<T: ?Sized> *const T {
1203
1205
/// let mut out = String::new();
1204
1206
/// while ptr != start_rounded_down {
1205
1207
/// unsafe {
1206
- /// write!(&mut out, "{}, ", *ptr).unwrap() ;
1208
+ /// write!(&mut out, "{}, ", *ptr)? ;
1207
1209
/// }
1208
1210
/// ptr = ptr.wrapping_sub(step);
1209
1211
/// }
1210
1212
/// assert_eq!(out, "5, 3, 1, ");
1213
+ /// # std::fmt::Result::Ok(())
1211
1214
/// ```
1212
1215
#[ stable( feature = "pointer_methods" , since = "1.26.0" ) ]
1213
1216
#[ must_use = "returns a new pointer rather than modifying its argument" ]
0 commit comments