Fixed and made the comments clearer

This commit is contained in:
kevgeniy 2016-10-16 17:13:02 +02:00 committed by GitHub
parent dd16c58ab4
commit 2060048c79

View file

@ -320,6 +320,9 @@ impl<'a, W: Write> UnsafeWriter<'a, W> {
} }
} }
// This method was used in Write::write only. It must not be called in the correct cat code
// and is placed in the bottleneck place, so it is not used anymore.
// Uncomment this and code in Write::write for more convenient testing of a new cat version.
//#[inline(never)] //#[inline(never)]
//fn fail() -> ! { //fn fail() -> ! {
// panic!("assertion failed"); // panic!("assertion failed");
@ -329,8 +332,8 @@ impl<'a, W: Write> Write for UnsafeWriter<'a, W> {
fn write(&mut self, buf: &[u8]) -> Result<usize> { fn write(&mut self, buf: &[u8]) -> Result<usize> {
//let dst = &mut self.buf[self.pos..]; //let dst = &mut self.buf[self.pos..];
let len = buf.len(); let len = buf.len();
// assertion is true for current code // the condition is false for current code and every correct code
// and it is a bottlneck place // see fail method comment for more information
// if len > dst.len() { // if len > dst.len() {
// fail(); // fail();
// } // }