cargo fixes

This commit is contained in:
Daniella 2023-02-25 12:41:36 +01:00
parent e037dbabe9
commit 26044549b9
Signed by: TudbuT
GPG key ID: 7D63D5634B7C417F
2 changed files with 9 additions and 9 deletions

View file

@ -1,4 +1,4 @@
use spl::{runtime::*, start_file}; use spl::{start_file};
use std::env::args; use std::env::args;

View file

@ -191,7 +191,7 @@ pub fn plus(stack: &mut Stack) -> OError {
stack.push( stack.push(
match (a, b) { match (a, b) {
(Value::Mega(a), Value::Mega(b)) => Value::Mega(a + b), (Value::Mega(a), Value::Mega(b)) => Value::Mega(a + b),
x => stack.err(ErrorKind::InvalidCall("plus".to_owned()))?, _x => stack.err(ErrorKind::InvalidCall("plus".to_owned()))?,
} }
.spl(), .spl(),
); );
@ -611,15 +611,15 @@ pub fn command(stack: &mut Stack) -> OError {
return stack.err(ErrorKind::InvalidCall("command".to_owned())) return stack.err(ErrorKind::InvalidCall("command".to_owned()))
}; };
let mut args = Vec::new(); let mut args = Vec::new();
for item in a.into_iter() { for item in a.iter() {
if let Value::Str(ref s) = item.lock_ro().native { if let Value::Str(ref s) = item.lock_ro().native {
args.push(s.to_owned()); args.push(s.to_owned());
} }
} }
if args.len() < 1 { if args.is_empty() {
return stack.err(ErrorKind::InvalidCall("command".to_owned())); return stack.err(ErrorKind::InvalidCall("command".to_owned()));
} }
process::Command::new(args[0].to_owned()) process::Command::new(&args[0])
.args(&args[1..]) .args(&args[1..])
.stdin(Stdio::inherit()) .stdin(Stdio::inherit())
.stdout(Stdio::inherit()) .stdout(Stdio::inherit())
@ -635,19 +635,19 @@ pub fn command_wait(stack: &mut Stack) -> OError {
return stack.err(ErrorKind::InvalidCall("command".to_owned())) return stack.err(ErrorKind::InvalidCall("command".to_owned()))
}; };
let mut args = Vec::new(); let mut args = Vec::new();
for item in a.into_iter() { for item in a.iter() {
if let Value::Str(ref s) = item.lock_ro().native { if let Value::Str(ref s) = item.lock_ro().native {
args.push(s.to_owned()); args.push(s.to_owned());
} else { } else {
return stack.err(ErrorKind::InvalidCall("command".to_owned())); return stack.err(ErrorKind::InvalidCall("command".to_owned()));
} }
} }
if args.len() < 1 { if args.is_empty() {
return stack.err(ErrorKind::InvalidCall("command".to_owned())); return stack.err(ErrorKind::InvalidCall("command".to_owned()));
} }
stack.push( stack.push(
Value::Int( Value::Int(
process::Command::new(args[0].to_owned()) process::Command::new(&args[0])
.args(&args[1..]) .args(&args[1..])
.stdin(Stdio::inherit()) .stdin(Stdio::inherit())
.stdout(Stdio::inherit()) .stdout(Stdio::inherit())
@ -681,7 +681,7 @@ pub fn str_to_bytes(stack: &mut Stack) -> OError {
pub fn bytes_to_str(stack: &mut Stack) -> OError { pub fn bytes_to_str(stack: &mut Stack) -> OError {
require_array_on_stack!(a, stack, "str-to-bytes"); require_array_on_stack!(a, stack, "str-to-bytes");
let mut chars = Vec::new(); let mut chars = Vec::new();
for item in a.into_iter() { for item in a.iter() {
if let Value::Int(x) = item.lock_ro().native.clone().try_mega_to_int() { if let Value::Int(x) = item.lock_ro().native.clone().try_mega_to_int() {
chars.push(x as u8); chars.push(x as u8);
} else { } else {