Skip to content

Commit 606318f

Browse files
committed
refactor(rand): use writeln to write to stdout
Signed-off-by: Roman Volosatovs <[email protected]>
1 parent 457e7c1 commit 606318f

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

examples/rand.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@ fn main() {
77
let mut stdout = wasi::cli::stdout::get_stdout();
88

99
let r: u64 = HostRng.gen();
10-
stdout
11-
.write_all(format!("Cryptographically-secure random u64 is {r}\n").as_bytes())
12-
.unwrap();
10+
writeln!(stdout, "Cryptographically-secure random u64 is {r}").unwrap();
1311

1412
let r: u64 = HostInsecureRng.gen();
15-
stdout
16-
.write_all(format!("Pseudo-random u64 is {r}\n").as_bytes())
17-
.unwrap();
13+
writeln!(stdout, "Pseudo-random u64 is {r}").unwrap();
1814

1915
stdout.flush().unwrap();
2016
}

0 commit comments

Comments
 (0)