Skip to content

Commit e0a721f

Browse files
authored
Merge pull request #1430 from gpk2000/master
broken long comments in src/types/cast.md to several shortones
2 parents 8e75749 + a3e714d commit e0a721f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/types/cast.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ fn main() {
2222
let integer = decimal as u8;
2323
let character = integer as char;
2424
25-
// Error! There are limitations in conversion rules. A float cannot be directly converted to a char.
25+
// Error! There are limitations in conversion rules.
26+
// A float cannot be directly converted to a char.
2627
let character = decimal as char;
2728
// FIXME ^ Comment out this line
2829
@@ -60,8 +61,10 @@ fn main() {
6061
// and the two's complement of 232 is -24
6162
println!(" 232 as a i8 is : {}", 232 as i8);
6263
63-
// Since Rust 1.45, the `as` keyword performs a *saturating cast* when casting from float to int.
64-
// If the floating point value exceeds the upper bound or is less than the lower bound, the returned value will be equal to the bound crossed.
64+
// Since Rust 1.45, the `as` keyword performs a *saturating cast*
65+
// when casting from float to int. If the floating point value exceeds
66+
// the upper bound or is less than the lower bound, the returned value
67+
// will be equal to the bound crossed.
6568
6669
// 300.0 is 255
6770
println!("300.0 is {}", 300.0_f32 as u8);
@@ -70,7 +73,9 @@ fn main() {
7073
// nan as u8 is 0
7174
println!("nan as u8 is {}", f32::NAN as u8);
7275
73-
// This behavior incurs a small runtime cost and can be avoided with unsafe methods, however the results might overflow and return **unsound values**. Use these methods wisely:
76+
// This behavior incurs a small runtime cost and can be avoided
77+
// with unsafe methods, however the results might overflow and
78+
// return **unsound values**. Use these methods wisely:
7479
unsafe {
7580
// 300.0 is 44
7681
println!("300.0 is {}", 300.0_f32.to_int_unchecked::<u8>());

0 commit comments

Comments
 (0)