Skip to content

Commit

Permalink
Auto merge of #64575 - lzutao:fmt-primitives-doc, r=jonas-schievink
Browse files Browse the repository at this point in the history
doc: Format some primitives examples

r? @jonas-schievink
  • Loading branch information
bors committed Sep 18, 2019
2 parents 64c0969 + bec0a76 commit dece573
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2092,11 +2092,14 @@ $to_xe_bytes_doc,
```
let bytes = ", $swap_op, stringify!($SelfT), ".to_ne_bytes();
assert_eq!(bytes, if cfg!(target_endian = \"big\") {
assert_eq!(
bytes,
if cfg!(target_endian = \"big\") {
", $be_bytes, "
} else {
", $le_bytes, "
});
}
);
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[rustc_const_unstable(feature = "const_int_conversion")]
Expand Down Expand Up @@ -2188,10 +2191,10 @@ $from_xe_bytes_doc,
```
let value = ", stringify!($SelfT), "::from_ne_bytes(if cfg!(target_endian = \"big\") {
", $be_bytes, "
} else {
", $le_bytes, "
});
", $be_bytes, "
} else {
", $le_bytes, "
});
assert_eq!(value, ", $swap_op, ");
```
Expand Down Expand Up @@ -3911,11 +3914,14 @@ $to_xe_bytes_doc,
```
let bytes = ", $swap_op, stringify!($SelfT), ".to_ne_bytes();
assert_eq!(bytes, if cfg!(target_endian = \"big\") {
assert_eq!(
bytes,
if cfg!(target_endian = \"big\") {
", $be_bytes, "
} else {
", $le_bytes, "
});
}
);
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[rustc_const_unstable(feature = "const_int_conversion")]
Expand Down Expand Up @@ -4007,10 +4013,10 @@ $from_xe_bytes_doc,
```
let value = ", stringify!($SelfT), "::from_ne_bytes(if cfg!(target_endian = \"big\") {
", $be_bytes, "
} else {
", $le_bytes, "
});
", $be_bytes, "
} else {
", $le_bytes, "
});
assert_eq!(value, ", $swap_op, ");
```
Expand Down

0 comments on commit dece573

Please sign in to comment.