Skip to content

Commit

Permalink
Run rustfmt check on CI (wasmi-labs#154)
Browse files Browse the repository at this point in the history
* Run rustfmt check on CI

* Reformat.
  • Loading branch information
pepyakin authored Jan 2, 2019
1 parent e047f50 commit d52ba88
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ env:

install:
- if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then rustup target add wasm32-unknown-unknown; fi
- rustup component add rustfmt
script:
- cargo fmt --all -- --check
# Make sure nightly targets are not broken.
- if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then cargo check --tests --manifest-path=fuzz/Cargo.toml; fi
- if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then cargo check --benches --manifest-path=benches/Cargo.toml; fi
Expand Down
26 changes: 13 additions & 13 deletions src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl MemoryInstance {
}

/// Returns current used memory size in bytes.
/// This is the highest memory address that had been written to.
/// This is the highest memory address that had been written to.
pub fn used_size(&self) -> Bytes {
Bytes(self.buffer.borrow().len())
}
Expand Down Expand Up @@ -392,9 +392,9 @@ impl MemoryInstance {
let (read_region, write_region) =
self.checked_region_pair(&mut buffer, src_offset, len, dst_offset, len)?;

if dst_offset < self.lowest_used.get() as usize {
self.lowest_used.set(dst_offset as u32);
}
if dst_offset < self.lowest_used.get() as usize {
self.lowest_used.set(dst_offset as u32);
}

unsafe {
::core::ptr::copy(
Expand Down Expand Up @@ -435,9 +435,9 @@ impl MemoryInstance {
)));
}

if dst_offset < self.lowest_used.get() as usize {
self.lowest_used.set(dst_offset as u32);
}
if dst_offset < self.lowest_used.get() as usize {
self.lowest_used.set(dst_offset as u32);
}

unsafe {
::core::ptr::copy_nonoverlapping(
Expand Down Expand Up @@ -478,9 +478,9 @@ impl MemoryInstance {
.checked_region(&mut dst_buffer, dst_offset, len)?
.range();

if dst_offset < dst.lowest_used.get() as usize {
dst.lowest_used.set(dst_offset as u32);
}
if dst_offset < dst.lowest_used.get() as usize {
dst.lowest_used.set(dst_offset as u32);
}

dst_buffer[dst_range].copy_from_slice(&src_buffer[src_range]);

Expand All @@ -499,9 +499,9 @@ impl MemoryInstance {

let range = self.checked_region(&mut buffer, offset, len)?.range();

if offset < self.lowest_used.get() as usize {
self.lowest_used.set(offset as u32);
}
if offset < self.lowest_used.get() as usize {
self.lowest_used.set(offset as u32);
}

for val in &mut buffer[range] {
*val = new_val
Expand Down

0 comments on commit d52ba88

Please sign in to comment.