From 92a4410e314fba4fe8e7deca0cf2b273cbf32a74 Mon Sep 17 00:00:00 2001 From: parazyd Date: Wed, 16 Mar 2022 22:30:31 +0100 Subject: [PATCH] Miscellaneous fixes and 'make fix'. --- .gitignore | 1 + Cargo.lock | 27 +++-------- bin/cashierd/Cargo.toml | 2 +- bin/cashierd/src/main.rs | 2 +- bin/cashierd/src/service/btc.rs | 4 +- bin/dao-cli/src/main.rs | 2 +- bin/daod/src/main.rs | 2 +- bin/darkfid/src/main.rs | 2 +- bin/dnetview/Cargo.toml | 2 +- bin/dnetview/src/options.rs | 4 +- bin/dnetview/src/ui.rs | 6 +-- bin/dnetview/src/view.rs | 2 +- bin/drk/src/main.rs | 8 ++-- bin/gatewayd/src/main.rs | 2 +- bin/taud/src/main.rs | 55 +++++++++-------------- bin/taud/src/util.rs | 12 +++-- bin/vanityaddr/src/main.rs | 2 +- src/crypto/constants/util.rs | 4 +- src/runtime/mod.rs | 2 +- src/runtime/util.rs | 2 +- src/runtime/{runtime.rs => vm_runtime.rs} | 0 src/zk/circuit/mint_contract.rs | 7 ++- src/zk/circuit/spend_contract.rs | 14 +++--- src/zk/vm.rs | 10 ++--- src/zkas/analyzer.rs | 2 +- src/zkas/compiler.rs | 2 +- src/zkas/lexer.rs | 2 +- src/zkas/parser.rs | 2 +- 28 files changed, 72 insertions(+), 110 deletions(-) rename src/runtime/{runtime.rs => vm_runtime.rs} (100%) diff --git a/.gitignore b/.gitignore index 62f33e4e1..9998471e3 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ /ircd /map /vanityaddr +/dnetview diff --git a/Cargo.lock b/Cargo.lock index c037ad6d9..1381d9672 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -537,7 +537,7 @@ dependencies = [ "base64-compat", "bech32", "bitcoin_hashes", - "secp256k1 0.20.3", + "secp256k1", "serde", ] @@ -850,7 +850,7 @@ dependencies = [ "num-bigint", "num_cpus", "rand 0.8.5", - "secp256k1 0.22.1", + "secp256k1", "serde", "serde_json", "simplelog", @@ -4630,19 +4630,10 @@ name = "secp256k1" version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97d03ceae636d0fed5bae6a7f4f664354c5f4fcedf6eef053fef17e49f837d0a" -dependencies = [ - "secp256k1-sys 0.4.2", - "serde", -] - -[[package]] -name = "secp256k1" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26947345339603ae8395f68e2f3d85a6b0a8ddfe6315818e80b8504415099db0" dependencies = [ "rand 0.6.5", - "secp256k1-sys 0.5.0", + "secp256k1-sys", + "serde", ] [[package]] @@ -4654,15 +4645,6 @@ dependencies = [ "cc", ] -[[package]] -name = "secp256k1-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07b5b9d7322572e1f3aeed208668ce87789b3645dbb73082c5ce99a004103a35" -dependencies = [ - "cc", -] - [[package]] name = "security-framework" version = "2.4.2" @@ -6227,6 +6209,7 @@ dependencies = [ "bitflags", "cassowary", "crossterm", + "termion", "unicode-segmentation", "unicode-width", ] diff --git a/bin/cashierd/Cargo.toml b/bin/cashierd/Cargo.toml index 38650dbe6..0c87c060c 100644 --- a/bin/cashierd/Cargo.toml +++ b/bin/cashierd/Cargo.toml @@ -36,7 +36,7 @@ serde_json = "1.0.79" bdk = {version = "0.16.1", optional = true} anyhow = {version = "1.0.56", optional = true} bitcoin = {version = "0.27.1", optional = true} -secp256k1 = {version = "0.22.1", default-features = false, features = ["rand-std"], optional = true} +secp256k1 = {version = "0.20.1", default-features = false, features = ["rand-std"], optional = true} # Ethereum bridge dependencies hex = {version = "0.4.3", optional = true} diff --git a/bin/cashierd/src/main.rs b/bin/cashierd/src/main.rs index 23641cf43..f9cb4066d 100644 --- a/bin/cashierd/src/main.rs +++ b/bin/cashierd/src/main.rs @@ -736,7 +736,7 @@ async fn start( #[async_std::main] async fn main() -> Result<()> { let args = CliCashierd::parse(); - let matches = CliCashierd::into_app().get_matches(); + let matches = CliCashierd::command().get_matches(); let config_path = if args.config.is_some() { expand_path(&args.config.unwrap())? diff --git a/bin/cashierd/src/service/btc.rs b/bin/cashierd/src/service/btc.rs index a025d4819..e7bda3ea1 100644 --- a/bin/cashierd/src/service/btc.rs +++ b/bin/cashierd/src/service/btc.rs @@ -761,7 +761,7 @@ pub struct BtcTransaction(bitcoin::Transaction); pub struct BtcAddress(bitcoin::Address); pub struct BtcPublicKey(bitcoin::PublicKey); pub struct BtcPrivateKey(bitcoin::PrivateKey); -pub struct SecPublicKey(secp256k1::key::PublicKey); +pub struct SecPublicKey(secp256k1::PublicKey); impl Encodable for BtcTransaction { fn encode(&self, s: S) -> Result { @@ -830,7 +830,7 @@ impl Encodable for SecPublicKey { impl Decodable for SecPublicKey { fn decode(mut d: D) -> Result { let key: Vec = Decodable::decode(&mut d)?; - let key = secp256k1::key::PublicKey::from_slice(&key) + let key = secp256k1::PublicKey::from_slice(&key) .map_err(|err| darkfi::Error::from(BtcFailed::from(err)))?; Ok(SecPublicKey(key)) } diff --git a/bin/dao-cli/src/main.rs b/bin/dao-cli/src/main.rs index b6eed3c52..e7e6d32b6 100644 --- a/bin/dao-cli/src/main.rs +++ b/bin/dao-cli/src/main.rs @@ -85,7 +85,7 @@ async fn start(options: CliDao) -> Result<()> { #[async_std::main] async fn main() -> Result<()> { let args = CliDao::parse(); - let _matches = CliDao::into_app().get_matches(); + let _matches = CliDao::command().get_matches(); //let config_path = if args.config.is_some() { // expand_path(&args.config.clone().unwrap())? diff --git a/bin/daod/src/main.rs b/bin/daod/src/main.rs index cc7e753af..51c28c90d 100644 --- a/bin/daod/src/main.rs +++ b/bin/daod/src/main.rs @@ -64,7 +64,7 @@ impl JsonRpcInterface { async fn main() -> Result<()> { //let args = CliDao::parse(); - //let matches = CliDao::into_app().get_matches(); + //let matches = CliDao::command().get_matches(); TermLogger::init( LevelFilter::Debug, diff --git a/bin/darkfid/src/main.rs b/bin/darkfid/src/main.rs index a1afc8ebb..e85e5ee92 100644 --- a/bin/darkfid/src/main.rs +++ b/bin/darkfid/src/main.rs @@ -874,7 +874,7 @@ async fn start( #[async_std::main] async fn main() -> Result<()> { let args = CliDarkfid::parse(); - let matches = CliDarkfid::into_app().get_matches(); + let matches = CliDarkfid::command().get_matches(); let config_path = if args.config.is_some() { expand_path(&args.config.unwrap())? diff --git a/bin/dnetview/Cargo.toml b/bin/dnetview/Cargo.toml index ce3e71a81..5f8b0e55c 100644 --- a/bin/dnetview/Cargo.toml +++ b/bin/dnetview/Cargo.toml @@ -10,7 +10,7 @@ features = ["rpc"] [dependencies] # Tui termion = "1.5.6" -tui = "0.17.0" +tui = {version = "0.17.0", features = ["termion"]} # Async smol = "1.2.5" diff --git a/bin/dnetview/src/options.rs b/bin/dnetview/src/options.rs index b868e3fd1..bbea989f0 100644 --- a/bin/dnetview/src/options.rs +++ b/bin/dnetview/src/options.rs @@ -1,4 +1,4 @@ -use clap::{App, Arg, ArgMatches}; +use clap::{Arg, ArgMatches, Command}; use darkfi::Result; @@ -9,7 +9,7 @@ pub struct ProgramOptions { impl ProgramOptions { pub fn load() -> Result { - let app = App::new("dnetview") + let app = Command::new("dnetview") .version("0.1.0") .author("lunar_mining") .about("dnetview") diff --git a/bin/dnetview/src/ui.rs b/bin/dnetview/src/ui.rs index 070765a83..c0e89edd3 100644 --- a/bin/dnetview/src/ui.rs +++ b/bin/dnetview/src/ui.rs @@ -3,7 +3,7 @@ use log::debug; use tui::{ backend::Backend, - layout::{Alignment, Constraint, Direction, Layout, Rect}, + layout::{Constraint, Direction, Layout, Rect}, style::Style, text::{Span, Spans}, widgets::{Block, Borders, List, ListItem, Paragraph}, @@ -37,7 +37,7 @@ pub fn ui(f: &mut Frame<'_, B>, mut view: View) { format!(" [S: {}]", slot.channel.last_msg), style, ), - a => Span::styled(format!("{}", a), style), + a => Span::styled(a.to_string(), style), }; lines.push(Spans::from(vec![addr, msg])); } else { @@ -59,7 +59,7 @@ pub fn ui(f: &mut Frame<'_, B>, mut view: View) { format!(" [R: {}]", connect.channel.last_msg), style, ), - a => Span::styled(format!("{}", a), style), + a => Span::styled(a.to_string(), style), }; lines.push(Spans::from(vec![addr, msg])); } else { diff --git a/bin/dnetview/src/view.rs b/bin/dnetview/src/view.rs index 780624307..b814d6d60 100644 --- a/bin/dnetview/src/view.rs +++ b/bin/dnetview/src/view.rs @@ -14,7 +14,7 @@ impl View { } pub fn update(&mut self, infos: HashMap) { - for (id, info) in infos.clone() { + for (id, info) in infos { self.id_list.node_id.insert(id.clone()); self.info_list.infos.insert(id, info); } diff --git a/bin/drk/src/main.rs b/bin/drk/src/main.rs index f67e2d6c9..edb8b6630 100644 --- a/bin/drk/src/main.rs +++ b/bin/drk/src/main.rs @@ -1,6 +1,6 @@ use std::{path::PathBuf, str::FromStr}; -use clap::{AppSettings, IntoApp, Parser, Subcommand}; +use clap::{IntoApp, Parser, Subcommand}; use log::{debug, error}; use prettytable::{cell, format, row, Table}; use serde::{Deserialize, Serialize}; @@ -115,9 +115,6 @@ pub enum CliDrkSubCommands { #[derive(Parser)] #[clap(name = "drk")] #[clap(author, version, about)] -#[clap(global_setting(AppSettings::PropagateVersion))] -#[clap(global_setting(AppSettings::UseLongFormatForHelpSubcommand))] -#[clap(setting(AppSettings::SubcommandRequiredElseHelp))] pub struct CliDrk { /// Sets a custom config file #[clap(short, long)] @@ -471,7 +468,8 @@ async fn start(config: &DrkConfig, options: CliDrk) -> Result<()> { #[async_std::main] async fn main() -> Result<()> { let args = CliDrk::parse(); - let matches = CliDrk::into_app().get_matches(); + let matches = + CliDrk::command().propagate_version(true).arg_required_else_help(true).get_matches(); let config_path = if args.config.is_some() { expand_path(&args.config.clone().unwrap())? diff --git a/bin/gatewayd/src/main.rs b/bin/gatewayd/src/main.rs index df297c6e7..046ec3bf3 100644 --- a/bin/gatewayd/src/main.rs +++ b/bin/gatewayd/src/main.rs @@ -64,7 +64,7 @@ async fn start(executor: Arc>, config: &GatewaydConfig) -> Result<( #[async_std::main] async fn main() -> Result<()> { let args = CliGatewayd::parse(); - let matches = CliGatewayd::into_app().get_matches(); + let matches = CliGatewayd::command().get_matches(); let config_path = if args.config.is_some() { expand_path(&args.config.unwrap())? diff --git a/bin/taud/src/main.rs b/bin/taud/src/main.rs index adab133fc..c6a19a80f 100644 --- a/bin/taud/src/main.rs +++ b/bin/taud/src/main.rs @@ -152,17 +152,12 @@ impl JsonRpcInterface { } let result = || -> Result> { - let tasks: Vec; - - if args[0].is_i64() { - tasks = MonthTasks::load_or_create( - &Timestamp(args[0].as_i64().unwrap()), - &self.settings, - )? - .objects()?; + let tasks: Vec = if args[0].is_i64() { + MonthTasks::load_or_create(&Timestamp(args[0].as_i64().unwrap()), &self.settings)? + .objects()? } else { - tasks = MonthTasks::load_current_open_tasks(&self.settings)?; - } + MonthTasks::load_current_open_tasks(&self.settings)? + }; Ok(tasks) }; @@ -195,12 +190,10 @@ impl JsonRpcInterface { let task_id = args[0].as_u64().unwrap(); let data = args[1].as_object().unwrap(); - let mut task: TaskInfo; - - match self.load_task_by_id(task_id) { - Ok(t) => task = t, + let mut task: TaskInfo = match self.load_task_by_id(task_id) { + Ok(t) => t, Err(e) => return JsonResult::Err(jsonerr(InternalError, Some(e), id)), - } + }; let mut result = || -> std::result::Result<(), String> { if data.contains_key("title") { @@ -297,12 +290,10 @@ impl JsonRpcInterface { let task_id = args[0].as_u64().unwrap(); - let task: TaskInfo; - - match self.load_task_by_id(task_id) { - Ok(t) => task = t, + let task: TaskInfo = match self.load_task_by_id(task_id) { + Ok(t) => t, Err(e) => return JsonResult::Err(jsonerr(InternalError, Some(e), id)), - } + }; JsonResult::Resp(jsonresp(json!(task.get_state()), id)) } @@ -325,12 +316,10 @@ impl JsonRpcInterface { let task_id = args[0].as_u64().unwrap(); let state = args[1].as_str().unwrap(); - let mut task: TaskInfo; - - match self.load_task_by_id(task_id) { - Ok(t) => task = t, + let mut task: TaskInfo = match self.load_task_by_id(task_id) { + Ok(t) => t, Err(e) => return JsonResult::Err(jsonerr(InternalError, Some(e), id)), - } + }; task.set_state(state); @@ -371,12 +360,10 @@ impl JsonRpcInterface { let comment_author = args[1].as_str().unwrap(); let comment_content = args[2].as_str().unwrap(); - let mut task: TaskInfo; - - match self.load_task_by_id(task_id) { - Ok(t) => task = t, + let mut task: TaskInfo = match self.load_task_by_id(task_id) { + Ok(t) => t, Err(e) => return JsonResult::Err(jsonerr(InternalError, Some(e), id)), - } + }; task.set_comment(Comment::new(comment_content, comment_author)); @@ -387,12 +374,10 @@ impl JsonRpcInterface { } fn load_task_by_id(&self, task_id: u64) -> std::result::Result { - let tasks: Vec; - - match MonthTasks::load_current_open_tasks(&self.settings) { - Ok(tks) => tasks = tks, + let tasks: Vec = match MonthTasks::load_current_open_tasks(&self.settings) { + Ok(v) => v, Err(e) => return Err(e.to_string()), - } + }; let task = tasks.into_iter().find(|t| (t.get_id() as u64) == task_id); diff --git a/bin/taud/src/util.rs b/bin/taud/src/util.rs index 854fc827c..a91027d39 100644 --- a/bin/taud/src/util.rs +++ b/bin/taud/src/util.rs @@ -1,4 +1,8 @@ -use std::{fs::File, io::BufReader, path::PathBuf}; +use std::{ + fs::File, + io::BufReader, + path::{Path, PathBuf}, +}; use chrono::Utc; use clap::Parser; @@ -17,7 +21,7 @@ pub fn get_current_time() -> Timestamp { Timestamp(Utc::now().timestamp()) } -pub fn find_free_id(task_ids: &Vec) -> u32 { +pub fn find_free_id(task_ids: &[u32]) -> u32 { for i in 1.. { if !task_ids.contains(&i) { return i @@ -26,7 +30,7 @@ pub fn find_free_id(task_ids: &Vec) -> u32 { 1 } -pub fn load(path: &PathBuf) -> Result { +pub fn load(path: &Path) -> Result { let file = File::open(path)?; let reader = BufReader::new(file); @@ -34,7 +38,7 @@ pub fn load(path: &PathBuf) -> Result { Ok(value) } -pub fn save(path: &PathBuf, value: &T) -> Result<()> { +pub fn save(path: &Path, value: &T) -> Result<()> { let file = File::create(path)?; serde_json::to_writer_pretty(file, value)?; Ok(()) diff --git a/bin/vanityaddr/src/main.rs b/bin/vanityaddr/src/main.rs index cfe9951be..79ef59dba 100644 --- a/bin/vanityaddr/src/main.rs +++ b/bin/vanityaddr/src/main.rs @@ -42,7 +42,7 @@ impl DrkAddr { fn main() -> Result<()> { let args = Args::parse(); - if args.prefix.chars().next() != Some('1') { + if !args.prefix.starts_with('1') { return Err(Error::ParseFailed("Address prefix must start with '1'")) } diff --git a/src/crypto/constants/util.rs b/src/crypto/constants/util.rs index 756f68521..e9876ca0d 100644 --- a/src/crypto/constants/util.rs +++ b/src/crypto/constants/util.rs @@ -8,10 +8,10 @@ pub fn gen_const_array( pub(crate) fn gen_const_array_with_default( default_value: Output, - mut closure: impl FnMut(usize) -> Output, + closure: impl FnMut(usize) -> Output, ) -> [Output; LEN] { let mut ret: [Output; LEN] = [default_value; LEN]; - for (bit, val) in ret.iter_mut().zip((0..LEN).map(|idx| closure(idx))) { + for (bit, val) in ret.iter_mut().zip((0..LEN).map(closure)) { *bit = val; } ret diff --git a/src/runtime/mod.rs b/src/runtime/mod.rs index 16956f6dc..8f45094bc 100644 --- a/src/runtime/mod.rs +++ b/src/runtime/mod.rs @@ -1,3 +1,3 @@ pub mod memory; -pub mod runtime; pub mod util; +pub mod vm_runtime; diff --git a/src/runtime/util.rs b/src/runtime/util.rs index 48a052583..c55c99e5c 100644 --- a/src/runtime/util.rs +++ b/src/runtime/util.rs @@ -1,6 +1,6 @@ use log::{error, warn}; -use super::{memory::MemoryManipulation, runtime::Env}; +use super::{memory::MemoryManipulation, vm_runtime::Env}; /// Serialize contract payload to format accepted by the runtime entrypoint. /// We keep the same payload as a slice of bytes, and prepend it with a diff --git a/src/runtime/runtime.rs b/src/runtime/vm_runtime.rs similarity index 100% rename from src/runtime/runtime.rs rename to src/runtime/vm_runtime.rs diff --git a/src/zk/circuit/mint_contract.rs b/src/zk/circuit/mint_contract.rs index 0dcfbf9ff..a114d3292 100644 --- a/src/zk/circuit/mint_contract.rs +++ b/src/zk/circuit/mint_contract.rs @@ -183,7 +183,7 @@ impl Circuit for MintContract { let poseidon_output = poseidon_hasher.hash(layouter.namespace(|| "Poseidon hash"), poseidon_message)?; - let poseidon_output: AssignedCell = poseidon_output.into(); + let poseidon_output: AssignedCell = poseidon_output; poseidon_output }; @@ -206,7 +206,7 @@ impl Circuit for MintContract { let value_commit_v = ValueCommitV; let value_commit_v = FixedPointShort::from_inner(ecc_chip.clone(), value_commit_v); value_commit_v - .mul(layouter.namespace(|| "[value] ValueCommitV"), (value.clone(), one.clone()))? + .mul(layouter.namespace(|| "[value] ValueCommitV"), (value, one.clone()))? }; // r_V * G_2 @@ -239,8 +239,7 @@ impl Circuit for MintContract { let (commitment, _) = { let token_commit_v = ValueCommitV; let token_commit_v = FixedPointShort::from_inner(ecc_chip.clone(), token_commit_v); - token_commit_v - .mul(layouter.namespace(|| "[token] ValueCommitV"), (token.clone(), one.clone()))? + token_commit_v.mul(layouter.namespace(|| "[token] ValueCommitV"), (token, one))? }; // r_A * G_2 diff --git a/src/zk/circuit/spend_contract.rs b/src/zk/circuit/spend_contract.rs index f930a3692..4a0b8bc44 100644 --- a/src/zk/circuit/spend_contract.rs +++ b/src/zk/circuit/spend_contract.rs @@ -171,12 +171,8 @@ impl Circuit for SpendContract { // Configuration for curve point operations. // This uses 10 advice columns and spans the whole circuit. - let ecc_config = EccChip::::configure( - meta, - advices, - lagrange_coeffs, - range_check.clone(), - ); + let ecc_config = + EccChip::::configure(meta, advices, lagrange_coeffs, range_check); // Configuration for the Poseidon hash let poseidon_config = PoseidonChip::configure::( @@ -198,7 +194,7 @@ impl Circuit for SpendContract { advices[6], lagrange_coeffs[0], lookup, - range_check.clone(), + range_check, ); let merkle_config_1 = MerkleChip::configure(meta, sinsemilla_config_1.clone()); (sinsemilla_config_1, merkle_config_1) @@ -271,7 +267,7 @@ impl Circuit for SpendContract { let poseidon_output = poseidon_hasher.hash(layouter.namespace(|| "Poseidon hash"), poseidon_message)?; - let poseidon_output: AssignedCell = poseidon_output.into(); + let poseidon_output: AssignedCell = poseidon_output; poseidon_output }; @@ -317,7 +313,7 @@ impl Circuit for SpendContract { let poseidon_output = poseidon_hasher.hash(layouter.namespace(|| "Poseidon hash"), poseidon_message)?; - let poseidon_output: AssignedCell = poseidon_output.into(); + let poseidon_output: AssignedCell = poseidon_output; poseidon_output }; diff --git a/src/zk/vm.rs b/src/zk/vm.rs index a5e90a466..5b13c39df 100644 --- a/src/zk/vm.rs +++ b/src/zk/vm.rs @@ -171,12 +171,8 @@ impl Circuit for ZkCircuit { // Configuration for curve point operations. // This uses 10 advice columns and spans the whole circuit. - let ecc_config = EccChip::::configure( - meta, - advices, - lagrange_coeffs, - range_check.clone(), - ); + let ecc_config = + EccChip::::configure(meta, advices, lagrange_coeffs, range_check); // Configuration for the Poseidon hash let poseidon_config = PoseidonChip::configure::( @@ -201,7 +197,7 @@ impl Circuit for ZkCircuit { advices[6], lagrange_coeffs[0], lookup, - range_check.clone(), + range_check, ); let merkle_cfg1 = MerkleChip::configure(meta, sinsemilla_cfg1.clone()); (sinsemilla_cfg1, merkle_cfg1) diff --git a/src/zkas/analyzer.rs b/src/zkas/analyzer.rs index 0d11971b7..bb7bf0a82 100644 --- a/src/zkas/analyzer.rs +++ b/src/zkas/analyzer.rs @@ -31,7 +31,7 @@ impl Analyzer { // For nice error reporting, we'll load everything into a string // vector so we have references to lines. let lines: Vec = source.as_str().lines().map(|x| x.to_string()).collect(); - let error = ErrorEmitter::new("Semantic", filename, lines.clone()); + let error = ErrorEmitter::new("Semantic", filename, lines); Analyzer { constants, witnesses, statements, stack: vec![], error } } diff --git a/src/zkas/compiler.rs b/src/zkas/compiler.rs index 73180bb9c..588c4b334 100644 --- a/src/zkas/compiler.rs +++ b/src/zkas/compiler.rs @@ -31,7 +31,7 @@ impl Compiler { // For nice error reporting, we'll load everything into a string // vector so we have references to lines. let lines: Vec = source.as_str().lines().map(|x| x.to_string()).collect(); - let error = ErrorEmitter::new("Compiler", filename, lines.clone()); + let error = ErrorEmitter::new("Compiler", filename, lines); Compiler { constants, witnesses, statements, debug_info, error } } diff --git a/src/zkas/lexer.rs b/src/zkas/lexer.rs index 1106292c8..d48fea14d 100644 --- a/src/zkas/lexer.rs +++ b/src/zkas/lexer.rs @@ -42,7 +42,7 @@ impl<'a> Lexer<'a> { // For nice error reporting, we'll load everything into a string // vector so we have references to lines. let lines: Vec = source.as_str().lines().map(|x| x.to_string()).collect(); - let error = ErrorEmitter::new("Lexer", filename, lines.clone()); + let error = ErrorEmitter::new("Lexer", filename, lines); Self { source, error } } diff --git a/src/zkas/parser.rs b/src/zkas/parser.rs index ba03d6200..547283d8b 100644 --- a/src/zkas/parser.rs +++ b/src/zkas/parser.rs @@ -24,7 +24,7 @@ impl Parser { // For nice error reporting, we'll load everything into a string // vector so we have references to lines. let lines: Vec = source.as_str().lines().map(|x| x.to_string()).collect(); - let error = ErrorEmitter::new("Parser", filename, lines.clone()); + let error = ErrorEmitter::new("Parser", filename, lines); Parser { tokens, error } }