Use slices rather than Vec borrows.
https://github.com/rust-lang-nursery/rust-clippy/wiki#ptr_arg
This commit is contained in:
@@ -433,7 +433,7 @@ impl<Variable> SSABuilder<Variable>
|
|||||||
temp_arg_val: Value,
|
temp_arg_val: Value,
|
||||||
temp_arg_var: Variable,
|
temp_arg_var: Variable,
|
||||||
dest_ebb: Ebb,
|
dest_ebb: Ebb,
|
||||||
preds: &Vec<(Block, Inst)>)
|
preds: &[(Block, Inst)])
|
||||||
-> (Value, SideEffects) {
|
-> (Value, SideEffects) {
|
||||||
let mut pred_values: ZeroOneOrMore<Value> = ZeroOneOrMore::Zero();
|
let mut pred_values: ZeroOneOrMore<Value> = ZeroOneOrMore::Zero();
|
||||||
// TODO: find a way not not allocate a vector
|
// TODO: find a way not not allocate a vector
|
||||||
|
|||||||
@@ -156,10 +156,10 @@ impl FunctionImports {
|
|||||||
pub fn translate_function_body(parser: &mut Parser,
|
pub fn translate_function_body(parser: &mut Parser,
|
||||||
function_index: FunctionIndex,
|
function_index: FunctionIndex,
|
||||||
sig: Signature,
|
sig: Signature,
|
||||||
locals: &Vec<(usize, Type)>,
|
locals: &[(usize, Type)],
|
||||||
exports: &Option<HashMap<FunctionIndex, String>>,
|
exports: &Option<HashMap<FunctionIndex, String>>,
|
||||||
signatures: &Vec<Signature>,
|
signatures: &[Signature],
|
||||||
functions: &Vec<SignatureIndex>,
|
functions: &[SignatureIndex],
|
||||||
il_builder: &mut ILBuilder<Local>,
|
il_builder: &mut ILBuilder<Local>,
|
||||||
runtime: &mut WasmRuntime)
|
runtime: &mut WasmRuntime)
|
||||||
-> Result<(Function, FunctionImports), String> {
|
-> Result<(Function, FunctionImports), String> {
|
||||||
@@ -288,8 +288,8 @@ fn translate_operator(op: &Operator,
|
|||||||
control_stack: &mut Vec<ControlStackFrame>,
|
control_stack: &mut Vec<ControlStackFrame>,
|
||||||
state: &mut TranslationState,
|
state: &mut TranslationState,
|
||||||
sig: &Signature,
|
sig: &Signature,
|
||||||
functions: &Vec<SignatureIndex>,
|
functions: &[SignatureIndex],
|
||||||
signatures: &Vec<Signature>,
|
signatures: &[Signature],
|
||||||
exports: &Option<HashMap<FunctionIndex, String>>,
|
exports: &Option<HashMap<FunctionIndex, String>>,
|
||||||
func_imports: &mut FunctionImports) {
|
func_imports: &mut FunctionImports) {
|
||||||
// This big match treats all Wasm code operators.
|
// This big match treats all Wasm code operators.
|
||||||
@@ -1290,8 +1290,8 @@ fn translate_unreachable_operator(op: &Operator,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn args_count(index: FunctionIndex,
|
fn args_count(index: FunctionIndex,
|
||||||
functions: &Vec<SignatureIndex>,
|
functions: &[SignatureIndex],
|
||||||
signatures: &Vec<Signature>)
|
signatures: &[Signature])
|
||||||
-> usize {
|
-> usize {
|
||||||
signatures[functions[index] as usize].argument_types.len()
|
signatures[functions[index] as usize].argument_types.len()
|
||||||
}
|
}
|
||||||
@@ -1301,9 +1301,9 @@ fn args_count(index: FunctionIndex,
|
|||||||
fn find_function_import(index: FunctionIndex,
|
fn find_function_import(index: FunctionIndex,
|
||||||
builder: &mut FunctionBuilder<Local>,
|
builder: &mut FunctionBuilder<Local>,
|
||||||
func_imports: &mut FunctionImports,
|
func_imports: &mut FunctionImports,
|
||||||
functions: &Vec<SignatureIndex>,
|
functions: &[SignatureIndex],
|
||||||
exports: &Option<HashMap<FunctionIndex, String>>,
|
exports: &Option<HashMap<FunctionIndex, String>>,
|
||||||
signatures: &Vec<Signature>)
|
signatures: &[Signature])
|
||||||
-> FuncRef {
|
-> FuncRef {
|
||||||
match func_imports.functions.get(&index) {
|
match func_imports.functions.get(&index) {
|
||||||
Some(local_index) => return *local_index,
|
Some(local_index) => return *local_index,
|
||||||
@@ -1358,7 +1358,7 @@ fn find_function_import(index: FunctionIndex,
|
|||||||
fn find_signature_import(sig_index: SignatureIndex,
|
fn find_signature_import(sig_index: SignatureIndex,
|
||||||
builder: &mut FunctionBuilder<Local>,
|
builder: &mut FunctionBuilder<Local>,
|
||||||
func_imports: &mut FunctionImports,
|
func_imports: &mut FunctionImports,
|
||||||
signatures: &Vec<Signature>)
|
signatures: &[Signature])
|
||||||
-> SigRef {
|
-> SigRef {
|
||||||
match func_imports.signatures.get(&(sig_index as usize)) {
|
match func_imports.signatures.get(&(sig_index as usize)) {
|
||||||
Some(local_sig_index) => return *local_sig_index,
|
Some(local_sig_index) => return *local_sig_index,
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ pub fn parse_global_section(parser: &mut Parser,
|
|||||||
|
|
||||||
pub fn parse_data_section(parser: &mut Parser,
|
pub fn parse_data_section(parser: &mut Parser,
|
||||||
runtime: &mut WasmRuntime,
|
runtime: &mut WasmRuntime,
|
||||||
globals: &Vec<Global>)
|
globals: &[Global])
|
||||||
-> Result<(), SectionParsingError> {
|
-> Result<(), SectionParsingError> {
|
||||||
loop {
|
loop {
|
||||||
let memory_index = match *parser.read() {
|
let memory_index = match *parser.read() {
|
||||||
@@ -314,7 +314,7 @@ pub fn parse_table_section(parser: &mut Parser,
|
|||||||
/// Retrieves the tables from the table section
|
/// Retrieves the tables from the table section
|
||||||
pub fn parse_elements_section(parser: &mut Parser,
|
pub fn parse_elements_section(parser: &mut Parser,
|
||||||
runtime: &mut WasmRuntime,
|
runtime: &mut WasmRuntime,
|
||||||
globals: &Vec<Global>)
|
globals: &[Global])
|
||||||
-> Result<(), SectionParsingError> {
|
-> Result<(), SectionParsingError> {
|
||||||
loop {
|
loop {
|
||||||
let table_index = match *parser.read() {
|
let table_index = match *parser.read() {
|
||||||
|
|||||||
Reference in New Issue
Block a user