diff options
| author | bors <bors@rust-lang.org> | 2014-02-03 10:41:34 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-02-03 10:41:34 -0800 |
| commit | cb40eba4b1ce12914612914b94bdccd251a9f554 (patch) | |
| tree | 5cb922f942920dc7d6b0f3606e9cd914360b2707 /src/libnative/io/timer_timerfd.rs | |
| parent | be4fc638092bf896c5c6c0672136b83b71e491ee (diff) | |
| parent | c765a8e7ad314651b92ff860cda0159c79dbec6e (diff) | |
| download | rust-cb40eba4b1ce12914612914b94bdccd251a9f554.tar.gz rust-cb40eba4b1ce12914612914b94bdccd251a9f554.zip | |
auto merge of #11946 : alexcrichton/rust/no-io-error, r=brson
Turns out this was a little more far-reaching than I thought it was. The first commit is the crux of this stack of commits. The `io::io_error` condition is completely removed and the `read` and `write` methods are altered to return `IoResult<T>`. This turned out to be an incredibly far-reaching change! Overall, I'm very happy with how this turned out (in addition with the `unused_must_use` lint). I had to almost rewrite the pretty printer in `libsyntax` as well as the the formatting in `librustdoc` (as one would expect). These two modules do *tons* of I/O, and I believe that it's definitely improved. This pull request also introduces the `if_ok!()` macro for returning-early from something that returns a result. I made quite liberal use of this in mostly the pretty printer and html renderer, and I found its usage generally quite pleasant and convenient to have. I didn't really feel like adding any other macro while I was using it, and I figured that pretty printing could be nicer, but it's nowhere near horrid today. This may be a controversial issue closing, but I'm going to say it. Closes #6163
Diffstat (limited to 'src/libnative/io/timer_timerfd.rs')
| -rw-r--r-- | src/libnative/io/timer_timerfd.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libnative/io/timer_timerfd.rs b/src/libnative/io/timer_timerfd.rs index ca20314997e..7c22e90bbff 100644 --- a/src/libnative/io/timer_timerfd.rs +++ b/src/libnative/io/timer_timerfd.rs @@ -96,7 +96,7 @@ fn helper(input: libc::c_int, messages: Port<Req>) { if fd == input { let mut buf = [0, ..1]; // drain the input file descriptor of its input - FileDesc::new(fd, false).inner_read(buf).unwrap(); + let _ = FileDesc::new(fd, false).inner_read(buf).unwrap(); incoming = true; } else { let mut bits = [0, ..8]; @@ -104,7 +104,7 @@ fn helper(input: libc::c_int, messages: Port<Req>) { // // FIXME: should this perform a send() this number of // times? - FileDesc::new(fd, false).inner_read(bits).unwrap(); + let _ = FileDesc::new(fd, false).inner_read(bits).unwrap(); let remove = { match map.find(&fd).expect("fd unregistered") { &(ref c, oneshot) => !c.try_send(()) || oneshot @@ -166,7 +166,8 @@ impl Timer { } pub fn sleep(ms: u64) { - unsafe { libc::usleep((ms * 1000) as libc::c_uint); } + // FIXME: this can fail because of EINTR, what do do? + let _ = unsafe { libc::usleep((ms * 1000) as libc::c_uint) }; } fn remove(&mut self) { |
