mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
clippy
This commit is contained in:
parent
ddf66293e9
commit
3f404dd114
2 changed files with 11 additions and 11 deletions
|
@ -301,7 +301,7 @@ impl<'a> CodeBuilder<'a> {
|
|||
// reserve one byte for num_batches
|
||||
self.preamble.push(0);
|
||||
|
||||
if local_types.len() == 0 {
|
||||
if local_types.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -384,9 +384,9 @@ impl<'a> CodeBuilder<'a> {
|
|||
}
|
||||
|
||||
/// Write out all the bytes in the right order
|
||||
pub fn serialize<W: std::io::Write>(&mut self, writer: &mut W) -> std::io::Result<usize> {
|
||||
writer.write(&self.inner_length)?;
|
||||
writer.write(&self.preamble)?;
|
||||
pub fn serialize<W: std::io::Write>(&mut self, writer: &mut W) -> std::io::Result<()> {
|
||||
writer.write_all(&self.inner_length)?;
|
||||
writer.write_all(&self.preamble)?;
|
||||
|
||||
// We created each insertion when a local was used for the _second_ time.
|
||||
// But we want them in the order they were first assigned, which may not be the same.
|
||||
|
@ -394,13 +394,13 @@ impl<'a> CodeBuilder<'a> {
|
|||
|
||||
let mut pos: usize = 0;
|
||||
for location in self.insert_locations.iter() {
|
||||
writer.write(&self.code[pos..location.insert_at])?;
|
||||
writer.write(&self.insert_bytes[location.start..location.end])?;
|
||||
writer.write_all(&self.code[pos..location.insert_at])?;
|
||||
writer.write_all(&self.insert_bytes[location.start..location.end])?;
|
||||
pos = location.insert_at;
|
||||
}
|
||||
|
||||
let len = self.code.len();
|
||||
writer.write(&self.code[pos..len])
|
||||
writer.write_all(&self.code[pos..len])
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
|
@ -493,7 +493,7 @@ impl<'a> CodeBuilder<'a> {
|
|||
panic!("Not implemented. Roc doesn't use function pointers");
|
||||
}
|
||||
|
||||
instruction_no_args!(drop, DROP, 1, false);
|
||||
instruction_no_args!(drop_, DROP, 1, false);
|
||||
instruction_no_args!(select, SELECT, 3, true);
|
||||
|
||||
pub fn get_local(&mut self, id: LocalId) {
|
||||
|
|
|
@ -266,10 +266,10 @@ encode_float!(encode_f64, f64);
|
|||
///
|
||||
/// The value 3 is encoded as 0x83 0x80 0x80 0x80 0x00.
|
||||
/// https://github.com/WebAssembly/tool-conventions/blob/main/Linking.md#relocation-sections
|
||||
pub fn overwrite_padded_u32<'a>(buffer: &mut [u8], value: u32) {
|
||||
pub fn overwrite_padded_u32(buffer: &mut [u8], value: u32) {
|
||||
let mut x = value;
|
||||
for i in 0..4 {
|
||||
buffer[i] = 0x80 | ((x & 0x7f) as u8);
|
||||
for byte in buffer.iter_mut().take(4) {
|
||||
*byte = 0x80 | ((x & 0x7f) as u8);
|
||||
x >>= 7;
|
||||
}
|
||||
buffer[4] = x as u8;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue