Add back Drop impl for Guard to fix Read::read_to_end

This commit is contained in:
bjorn3
2024-01-07 15:30:53 +01:00
parent b4275813f8
commit eff6700ff4
+6
View File
@@ -292,6 +292,12 @@ struct Guard<'a> {
len: usize,
}
impl<'a> Drop for Guard<'a> {
fn drop(&mut self) {
unsafe { self.buf.set_len(self.len); }
}
}
// A few methods below (read_to_string, read_line) will append data into a
// `String` buffer, but we need to be pretty careful when doing this. The
// implementation will just call `.as_mut_vec()` and then delegate to a