Skip to content

Commit

Permalink
Remove unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
anaPerezGhiglia committed Aug 7, 2024
1 parent 8da3eef commit 5a1625e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 29 deletions.
20 changes: 9 additions & 11 deletions tooling/nargo_cli/src/cli/dap_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ use acvm::FieldElement;
use bn254_blackbox_solver::Bn254BlackBoxSolver;
use clap::Args;
use nargo::constants::PROVER_INPUT_FILE;
use nargo::package::Package;
use nargo::workspace::Workspace;
use nargo::{insert_all_files_for_workspace_into_file_manager, package::Package, parse_all};
use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection};
use noirc_abi::input_parser::Format;
use noirc_driver::{
check_crate, file_manager_with_stdlib, CompileOptions, CompiledProgram,
NOIR_ARTIFACT_VERSION_STRING,
};
use noirc_driver::{check_crate, CompileOptions, CompiledProgram, NOIR_ARTIFACT_VERSION_STRING};
use noirc_frontend::{graph::CrateName, hir::FunctionNameMatch};

use std::io::{BufReader, BufWriter, Read, Write};
Expand Down Expand Up @@ -125,11 +122,11 @@ fn load_and_compile_project(
compile_options_for_debugging(acir_mode, skip_instrumentation, CompileOptions::default());

let compiled_program = match test_name {
Some(test_name) => load_and_compile_test_function(test_name, workspace, &package, &compile_options)?,
None => {
compile_bin_package_for_debugging(&workspace, &package, &compile_options)
.map_err(|_| LoadError::Generic("Failed to compile project".into()))?
},
Some(test_name) => {
load_and_compile_test_function(test_name, workspace, &package, &compile_options)?
}
None => compile_bin_package_for_debugging(&workspace, &package, &compile_options)
.map_err(|_| LoadError::Generic("Failed to compile project".into()))?,
};
let compiled_program = nargo::ops::transform_program(compiled_program, expression_width);

Expand All @@ -152,7 +149,8 @@ fn load_and_compile_test_function(
package: &Package,
compile_options: &CompileOptions,
) -> Result<CompiledProgram, LoadError> {
let (workspace_file_manager, mut parsed_files) = file_manager_and_files_from(&workspace.root_dir, &workspace);
let (workspace_file_manager, mut parsed_files) =
file_manager_and_files_from(&workspace.root_dir, &workspace);

let test_functions = get_tests_in_package(
&workspace_file_manager,
Expand Down
9 changes: 4 additions & 5 deletions tooling/nargo_cli/src/cli/debug_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ use nargo::errors::CompileError;
use nargo::ops::{compile_program, compile_program_with_debug_instrumenter, report_errors};
use nargo::package::Package;
use nargo::workspace::Workspace;
use nargo::{insert_all_files_for_workspace_into_file_manager, parse_all, NargoError};
use nargo::NargoError;
use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection};

use noirc_abi::input_parser::{Format, InputValue};
use noirc_abi::Abi;
use noirc_driver::{
file_manager_with_stdlib, CompileOptions, CompiledProgram, NOIR_ARTIFACT_VERSION_STRING,
};
use noirc_driver::{CompileOptions, CompiledProgram, NOIR_ARTIFACT_VERSION_STRING};
use noirc_frontend::graph::CrateName;

use super::compile_cmd::get_target_width;
Expand Down Expand Up @@ -101,7 +99,8 @@ pub(crate) fn compile_bin_package_for_debugging(
package: &Package,
compile_options: &CompileOptions,
) -> Result<CompiledProgram, CompileError> {
let (workspace_file_manager, mut parsed_files) = file_manager_and_files_from(std::path::Path::new(""), workspace);
let (workspace_file_manager, mut parsed_files) =
file_manager_and_files_from(std::path::Path::new(""), workspace);

let compilation_result = if compile_options.instrument_debug {
let debug_state =
Expand Down
10 changes: 6 additions & 4 deletions tooling/nargo_cli/src/cli/execution_helpers.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
use fm::{FileId, FileManager};
use nargo::{package::Package, workspace::Workspace};
use fm::FileManager;
use nargo::{insert_all_files_for_workspace_into_file_manager, parse_all, prepare_package};
use nargo::{package::Package, workspace::Workspace};
use noirc_driver::{file_manager_with_stdlib, link_to_debug_crate};
use noirc_frontend::{
debug::DebugInstrumenter,
graph::CrateId,
hir::{Context, ParsedFiles},
};

use std::collections::HashMap;
use std::path::Path;

pub(crate) fn prepare_package_for_debug<'a>(
Expand Down Expand Up @@ -57,7 +56,10 @@ pub(crate) fn instrument_package_files(

// TODO: should we create a type that englobe fileManager + parsed_files?
// all functions that need file_manager needs parsed_files as well
pub(crate) fn file_manager_and_files_from(root: &Path, workspace: &Workspace) -> (FileManager, ParsedFiles) {
pub(crate) fn file_manager_and_files_from(
root: &Path,
workspace: &Workspace,
) -> (FileManager, ParsedFiles) {
let mut workspace_file_manager = file_manager_with_stdlib(root);
insert_all_files_for_workspace_into_file_manager(workspace, &mut workspace_file_manager);
let parsed_files = parse_all(&workspace_file_manager);
Expand Down
18 changes: 9 additions & 9 deletions tooling/nargo_cli/src/cli/test_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@ use bn254_blackbox_solver::Bn254BlackBoxSolver;
use clap::Args;
use fm::FileManager;
use nargo::{
insert_all_files_for_workspace_into_file_manager, ops::test_status_program_compile_fail,
ops::test_status_program_compile_pass, ops::TestStatus, package::Package, parse_all,
prepare_package,
ops::test_status_program_compile_fail, ops::test_status_program_compile_pass, ops::TestStatus,
package::Package, prepare_package,
};
use nargo_toml::{get_package_manifest, resolve_workspace_from_toml, PackageSelection};
use noirc_driver::{
check_crate, compile_no_check, file_manager_with_stdlib, CompileOptions,
NOIR_ARTIFACT_VERSION_STRING,
};
use noirc_driver::{check_crate, compile_no_check, CompileOptions, NOIR_ARTIFACT_VERSION_STRING};
use noirc_frontend::{
graph::CrateName,
hir::{def_map::TestFunction, Context, FunctionNameMatch, ParsedFiles},
Expand All @@ -23,7 +19,10 @@ use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};

use crate::{cli::check_cmd::check_crate_and_report_errors, errors::CliError};

use super::{execution_helpers::{file_manager_and_files_from, prepare_package_for_debug}, NargoConfig};
use super::{
execution_helpers::{file_manager_and_files_from, prepare_package_for_debug},
NargoConfig,
};

/// Run the tests for this program
#[derive(Debug, Clone, Args)]
Expand Down Expand Up @@ -72,7 +71,8 @@ pub(crate) fn run(args: TestCommand, config: NargoConfig) -> Result<(), CliError
)?;
let debug_mode = args.debug;

let (workspace_file_manager, parsed_files) = file_manager_and_files_from(&workspace.root_dir, &workspace);
let (workspace_file_manager, parsed_files) =
file_manager_and_files_from(&workspace.root_dir, &workspace);

let pattern = match &args.test_name {
Some(name) => {
Expand Down

0 comments on commit 5a1625e

Please sign in to comment.