Skip to content

Commit d3dac5f

Browse files
committed
Fix rustfmt errors
1 parent f43eb91 commit d3dac5f

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/doc/src/reference/semver.md

+11-9
Original file line numberDiff line numberDiff line change
@@ -305,20 +305,22 @@ pub struct Foo {
305305
306306
///////////////////////////////////////////////////////////
307307
// Example usage that will break.
308+
use updated_crate::Foo;
309+
308310
fn main() {
309311
let foo = Foo {
310312
f1: 1,
311313
f2: 1000,
312314
f3: 5,
313315
};
314-
316+
315317
let foo_ptr = &foo as *const Foo as *const u8;
316-
318+
317319
// this is now unsound because of the change
318320
// SAFETY: Foo is repr(C), so we are guaranteed that there will be `3` at this offset (u8, 8 pad, u16)
319-
let f2 = unsafe { foo_ptr.offset(4).read() };
320-
321-
println!("{}", f2);
321+
let f3 = unsafe { foo_ptr.offset(4).read() };
322+
323+
assert_eq!(5, f3);
322324
}
323325
```
324326

@@ -534,12 +536,12 @@ pub enum Number {
534536
///////////////////////////////////////////////////////////
535537
// Example usage that will break.
536538
fn main() {
537-
let num_three = Number::Three;
538-
539+
let num_three = updated_crate::Number::Three;
540+
539541
// SAFETY: `Number` is `#[repr(i32)]`
540542
let three: i32 = unsafe { std::mem::transmute(num_three) }; // Error: cannot transmute between types of different sizes
541-
542-
println!("{}", three)
543+
544+
assert_eq!(3, three)
543545
}
544546
```
545547

0 commit comments

Comments
 (0)