diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-04-09 01:31:23 -0400 | 
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-04-14 01:15:46 -0400 | 
| commit | d9595d1737677dd61d9f52f674c34f13d708e39c (patch) | |
| tree | 304855240a098090a217dc325c4ca377b31d9ba2 /src/libcore/io.rs | |
| parent | 4bfa3c6663ad6facdbdb8bd533442b050085f753 (diff) | |
| download | rust-d9595d1737677dd61d9f52f674c34f13d708e39c.tar.gz rust-d9595d1737677dd61d9f52f674c34f13d708e39c.zip | |
core: remove unnecessary unsafe blocks/functions
Diffstat (limited to 'src/libcore/io.rs')
| -rw-r--r-- | src/libcore/io.rs | 23 | 
1 files changed, 9 insertions, 14 deletions
| diff --git a/src/libcore/io.rs b/src/libcore/io.rs index 3853e7c8f2b..3c5900f51a2 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -1536,11 +1536,8 @@ pub fn with_bytes_writer(f: &fn(@Writer)) -> ~[u8] { pub fn with_str_writer(f: &fn(@Writer)) -> ~str { let mut v = with_bytes_writer(f); - // FIXME (#3758): This should not be needed. - unsafe { - // Make sure the vector has a trailing null and is proper utf8. - v.push(0); - } + // Make sure the vector has a trailing null and is proper utf8. + v.push(0); assert!(str::is_utf8(v)); unsafe { ::cast::transmute(v) } @@ -1640,16 +1637,14 @@ pub mod fsync { // outer res pub fn FILE_res_sync(file: &FILERes, opt_level: Option<Level>, blk: &fn(v: Res<*libc::FILE>)) { - unsafe { - blk(Res(Arg { - val: file.f, opt_level: opt_level, - fsync_fn: |file, l| { - unsafe { - os::fsync_fd(libc::fileno(file), l) as int - } + blk(Res(Arg { + val: file.f, opt_level: opt_level, + fsync_fn: |file, l| { + unsafe { + os::fsync_fd(libc::fileno(file), l) as int } - })); - } + } + })); } // fsync fd after executing blk | 
