From 2a2e82efeb4e090abf9144b39be834972c7a0a4d Mon Sep 17 00:00:00 2001 From: mat Date: Wed, 24 Aug 2022 20:00:44 -0500 Subject: make some code more idiomatic --- azalea-buf/src/read.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'azalea-buf/src') diff --git a/azalea-buf/src/read.rs b/azalea-buf/src/read.rs index 7372018e..a7ebc10c 100644 --- a/azalea-buf/src/read.rs +++ b/azalea-buf/src/read.rs @@ -68,7 +68,7 @@ where } // fast varints modified from https://github.com/luojia65/mc-varint/blob/master/src/lib.rs#L67 - /// Read a single varint from the reader and return the value, along with the number of bytes read + /// Read a single varint from the reader and return the value fn read_varint(&mut self) -> Result { let mut buffer = [0]; let mut ans = 0; @@ -77,7 +77,7 @@ where .map_err(|_| BufReadError::InvalidVarInt)?; ans |= ((buffer[0] & 0b0111_1111) as i32) << (7 * i); if buffer[0] & 0b1000_0000 == 0 { - return Ok(ans); + break; } } Ok(ans) -- cgit v1.2.3