Skip to content

Commit

Permalink
Fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
PlasmaPower committed Jan 2, 2024
1 parent 5fb9a0e commit 206fdc5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
6 changes: 3 additions & 3 deletions arbitrator/jit/src/syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ pub fn js_value_call(mut env: WasmEnvMut, sp: u32) -> MaybeEscape {

let value = match (object, method_name.as_slice()) {
(Ref(GO_ID), b"_makeFuncWrapper") => {
let arg = match args.get(0) {
let arg = match args.first() {
Some(arg) => arg,
None => fail!(
"Go trying to call Go._makeFuncWrapper with bad args {:?}",
Expand Down Expand Up @@ -415,7 +415,7 @@ pub fn js_value_call(mut env: WasmEnvMut, sp: u32) -> MaybeEscape {
(Ref(CRYPTO_ID), b"getRandomValues") => {
let name = "crypto.getRandomValues";

let id = match args.get(0) {
let id = match args.first() {
Some(Ref(x)) => x,
_ => fail!("Go trying to call {name} with bad args {:?}", args),
};
Expand Down Expand Up @@ -456,7 +456,7 @@ pub fn js_value_new(mut env: WasmEnvMut, sp: u32) {
let args_len = sp.read_u64(2);
let args = sp.read_value_slice(args_ptr, args_len);
match class {
UINT8_ARRAY_ID => match args.get(0) {
UINT8_ARRAY_ID => match args.first() {
Some(JsValue::Number(size)) => {
let id = pool.insert(DynamicObject::Uint8Array(vec![0; *size as usize]));
sp.write_u64(4, GoValue::Object(id).encode());
Expand Down
2 changes: 1 addition & 1 deletion arbitrator/prover/src/kzg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ lazy_static::lazy_static! {
// order 2^32
let root: BigUint = "10238227357739495823651030575849232062558860180284477541189508159991286009131".parse().unwrap();
let exponent = (1_u64 << 32) / (FIELD_ELEMENTS_PER_BLOB as u64);
root.modpow(&BigUint::from(exponent), &*BLS_MODULUS)
root.modpow(&BigUint::from(exponent), &BLS_MODULUS)
};
}

Expand Down
8 changes: 2 additions & 6 deletions arbitrator/prover/src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ impl Module {
bin.memories.len() <= 1,
"Multiple memories are not supported"
);
if let Some(limits) = bin.memories.get(0) {
if let Some(limits) = bin.memories.first() {
let page_size = Memory::PAGE_SIZE;
let initial = limits.initial; // validate() checks this is less than max::u32
let allowed = u32::MAX as u64 / Memory::PAGE_SIZE - 1; // we require the size remain *below* 2^32
Expand Down Expand Up @@ -2286,11 +2286,7 @@ impl Machine {
next_inst.opcode,
Opcode::ReadPreImage | Opcode::ReadInboxMessage,
) {
let offset = self
.value_stack
.get(self.value_stack.len() - 1)
.unwrap()
.assume_u32();
let offset = self.value_stack.last().unwrap().assume_u32();
let ptr = self
.value_stack
.get(self.value_stack.len() - 2)
Expand Down

0 comments on commit 206fdc5

Please sign in to comment.