From 809a26505b5ceaf488151ba859f1a986d757b582 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Sat, 6 Aug 2022 07:45:19 +0300 Subject: Remove unnecessary parsing JSON already has a way to denote an array of objects, so there is no need to manually parse such arrays from strings. --- src/analysis.rs | 6 +----- src/parser.rs | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/analysis.rs b/src/analysis.rs index 08486a9..886e498 100644 --- a/src/analysis.rs +++ b/src/analysis.rs @@ -8,11 +8,7 @@ impl Analysis { //above should return a results - let x_vals: Vec = json_results - .x_vals - .split(",") - .map(|f| f.trim().parse::().unwrap()) - .collect(); + let x_vals: Vec = json_results.x_vals; let computation = correlations::Compute::new( json_results.file_delimiter, diff --git a/src/parser.rs b/src/parser.rs index 97ed18a..2e263f8 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -6,7 +6,7 @@ use std::io::Read; pub struct JsonData { pub file_path: String, - pub x_vals: String, + pub x_vals: Vec, pub sample_values: String, pub method: String, pub file_delimiter: char, -- cgit 1.4.1