Skip to content

Commit a5f384b

Browse files
authored
fix: erroneous white spaces in types/cast.md
2 parents 03491f3 + 5861467 commit a5f384b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/types/cast.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn main() {
2222
let integer = decimal as u8;
2323
let character = integer as char;
2424
25-
// Error! There are limitations in conversion rules.
25+
// Error! There are limitations in conversion rules.
2626
// A float cannot be directly converted to a char.
2727
let character = decimal as char;
2828
// FIXME ^ Comment out this line
@@ -52,7 +52,7 @@ fn main() {
5252
5353
// Unless it already fits, of course.
5454
println!(" 128 as a i16 is: {}", 128 as i16);
55-
55+
5656
// 128 as u8 -> 128, whose value in 8-bit two's complement representation is:
5757
println!(" 128 as a i8 is : {}", 128 as i8);
5858
@@ -61,21 +61,21 @@ fn main() {
6161
println!("1000 as a u8 is : {}", 1000 as u8);
6262
// and the value of 232 in 8-bit two's complement representation is -24
6363
println!(" 232 as a i8 is : {}", 232 as i8);
64-
65-
// Since Rust 1.45, the `as` keyword performs a *saturating cast*
66-
// when casting from float to int. If the floating point value exceeds
67-
// the upper bound or is less than the lower bound, the returned value
64+
65+
// Since Rust 1.45, the `as` keyword performs a *saturating cast*
66+
// when casting from float to int. If the floating point value exceeds
67+
// the upper bound or is less than the lower bound, the returned value
6868
// will be equal to the bound crossed.
69-
69+
7070
// 300.0 as u8 is 255
7171
println!(" 300.0 as u8 is : {}", 300.0_f32 as u8);
7272
// -100.0 as u8 is 0
7373
println!("-100.0 as u8 is : {}", -100.0_f32 as u8);
7474
// nan as u8 is 0
7575
println!(" nan as u8 is : {}", f32::NAN as u8);
76-
77-
// This behavior incurs a small runtime cost and can be avoided
78-
// with unsafe methods, however the results might overflow and
76+
77+
// This behavior incurs a small runtime cost and can be avoided
78+
// with unsafe methods, however the results might overflow and
7979
// return **unsound values**. Use these methods wisely:
8080
unsafe {
8181
// 300.0 as u8 is 44

0 commit comments

Comments
 (0)