diff options
| author | bors <bors@rust-lang.org> | 2019-09-18 12:31:00 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-09-18 12:31:00 +0000 |
| commit | dece57302a8e6775b34dd6447eb98552e83bdc9d (patch) | |
| tree | 412d9123c391dc2fbbd0cc198c23c3b55402383d | |
| parent | 64c09694a6ecc434cd3a61ade89beb1de17770c5 (diff) | |
| parent | bec0a7672752810547a3a191d49d56a338bc1c90 (diff) | |
Auto merge of #64575 - lzutao:fmt-primitives-doc, r=jonas-schievink
doc: Format some primitives examples r? @jonas-schievink
| -rw-r--r-- | src/libcore/num/mod.rs | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index df1c00ccd18..0cf2ebb487d 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -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")] @@ -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, "); ``` @@ -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")] @@ -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, "); ``` |
