Skip to content

Commit

Permalink
Clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
voltrevo committed Jul 24, 2024
1 parent 9c6280c commit 9b84429
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 15 deletions.
4 changes: 2 additions & 2 deletions valuescript_compiler/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ use crate::asm::{Number, Value};

pub const CONSTANTS: [(&str, Value); 3] = [
("undefined", Value::Undefined),
("NaN", Value::Number(Number(std::f64::NAN))),
("Infinity", Value::Number(Number(std::f64::INFINITY))),
("NaN", Value::Number(Number(f64::NAN))),
("Infinity", Value::Number(Number(f64::INFINITY))),
];
7 changes: 0 additions & 7 deletions valuescript_compiler/src/function_compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@ impl Functionish {
}
}

#[derive(Clone, Debug)]
pub struct QueuedFunction {
pub definition_pointer: Pointer,
pub fn_name: Option<String>,
pub functionish: Functionish,
}

pub struct LoopLabels {
pub continue_: Option<Label>,
pub break_: Label,
Expand Down
2 changes: 1 addition & 1 deletion valuescript_compiler/src/optimization/simplify_jumps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ fn simplify_jumps_fn(fn_: &mut Function) {
}
}

fn next_instruction_index(body: &Vec<FnLine>, mut i: usize) -> Option<usize> {
fn next_instruction_index(body: &[FnLine], mut i: usize) -> Option<usize> {
i += 1;

while i < body.len() {
Expand Down
2 changes: 0 additions & 2 deletions valuescript_vm/src/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,7 @@ pub fn op_triple_eq_impl(left: &Val, right: &Val) -> Result<bool, Val> {

true
}
#[allow(clippy::vtable_address_comparisons)] // TODO: Is this ok?
(Val::Static(left), Val::Static(right)) => std::ptr::eq(&**left, &**right),
#[allow(clippy::vtable_address_comparisons)] // TODO: Is this ok?
(Val::Dynamic(left), Val::Dynamic(right)) => std::ptr::eq(&**left, &**right),
(Val::Static(..) | Val::Dynamic(..) | Val::CopyCounter(..), _)
| (_, Val::Static(..) | Val::Dynamic(..) | Val::CopyCounter(..)) => {
Expand Down
2 changes: 1 addition & 1 deletion vstc/src/assemble_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use valuescript_compiler::{assemble, parse_module};

use crate::exit_command_failed::exit_command_failed;

pub fn assemble_command(args: &Vec<String>) {
pub fn assemble_command(args: &[String]) {
if args.len() != 3 {
exit_command_failed(args, None, "vstc assemble --help");
}
Expand Down
2 changes: 1 addition & 1 deletion vstc/src/compile_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use super::handle_diagnostics_cli::handle_diagnostics_cli;
use valuescript_compiler::asm::Structured;
use valuescript_compiler::compile;

pub fn compile_command(args: &Vec<String>) {
pub fn compile_command(args: &[String]) {
if args.len() != 3 {
exit_command_failed(args, None, "vstc compile --help");
}
Expand Down
2 changes: 1 addition & 1 deletion vstc/src/run_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use valuescript_vm::{vs_value::Val, DecoderMaker};
use crate::exit_command_failed::exit_command_failed;
use crate::to_bytecode::{format_from_path, to_bytecode, RunFormat};

pub fn run_command(args: &Vec<String>) {
pub fn run_command(args: &[String]) {
if args.len() < 3 {
exit_command_failed(args, None, "vstc run --help");
}
Expand Down

0 comments on commit 9b84429

Please sign in to comment.