Skip to content

Commit

Permalink
Rollup merge of rust-lang#58295 - RalfJung:stdio, r=alexcrichton
Browse files Browse the repository at this point in the history
std::sys::unix::stdio: explain why we do into_raw

I was quite puzzled why someone would call `into_raw` and then ignore the result.
  • Loading branch information
GuillaumeGomez authored Feb 10, 2019
2 parents 112629b + 541503a commit d59ca59
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libstd/sys/unix/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl Stdin {
pub fn read(&self, data: &mut [u8]) -> io::Result<usize> {
let fd = FileDesc::new(libc::STDIN_FILENO);
let ret = fd.read(data);
fd.into_raw();
fd.into_raw(); // do not close this FD
ret
}
}
Expand All @@ -23,7 +23,7 @@ impl Stdout {
pub fn write(&self, data: &[u8]) -> io::Result<usize> {
let fd = FileDesc::new(libc::STDOUT_FILENO);
let ret = fd.write(data);
fd.into_raw();
fd.into_raw(); // do not close this FD
ret
}

Expand All @@ -38,7 +38,7 @@ impl Stderr {
pub fn write(&self, data: &[u8]) -> io::Result<usize> {
let fd = FileDesc::new(libc::STDERR_FILENO);
let ret = fd.write(data);
fd.into_raw();
fd.into_raw(); // do not close this FD
ret
}

Expand Down

0 comments on commit d59ca59

Please sign in to comment.