From 01fae9b1e44545d707a0d85065d9ab3b92843db0 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sat, 18 Jun 2022 21:56:31 -0700 Subject: [PATCH] Do `use super::*;` instead of `use crate::common::*;` (#1239) --- src/alias.rs | 2 +- src/analyzer.rs | 2 +- src/assignment.rs | 2 +- src/assignment_resolver.rs | 2 +- src/ast.rs | 2 +- src/binding.rs | 2 +- src/color.rs | 2 +- src/color_display.rs | 2 +- src/command_ext.rs | 2 +- src/common.rs | 86 -------------------- src/compile_error.rs | 2 +- src/compile_error_kind.rs | 2 +- src/compiler.rs | 2 +- src/conditional_operator.rs | 2 +- src/config.rs | 2 +- src/config_error.rs | 2 +- src/count.rs | 2 +- src/dependency.rs | 2 +- src/enclosure.rs | 2 +- src/error.rs | 2 +- src/evaluator.rs | 2 +- src/expression.rs | 2 +- src/fragment.rs | 2 +- src/function.rs | 2 +- src/function_context.rs | 2 +- src/fuzzing.rs | 2 +- src/interrupt_guard.rs | 2 +- src/interrupt_handler.rs | 2 +- src/item.rs | 2 +- src/justfile.rs | 2 +- src/keyed.rs | 2 +- src/keyword.rs | 2 +- src/lexer.rs | 2 +- src/lib.rs | 70 +++++++++++++++- src/line.rs | 2 +- src/list.rs | 2 +- src/load_dotenv.rs | 2 +- src/loader.rs | 2 +- src/name.rs | 2 +- src/node.rs | 2 +- src/output.rs | 2 +- src/output_error.rs | 2 +- src/parameter.rs | 2 +- src/parameter_kind.rs | 2 +- src/parser.rs | 2 +- src/platform.rs | 2 +- src/platform_interface.rs | 2 +- src/positional.rs | 2 +- src/range_ext.rs | 2 +- src/recipe.rs | 2 +- src/recipe_context.rs | 2 +- src/recipe_resolver.rs | 2 +- src/run.rs | 2 +- src/scope.rs | 2 +- src/search.rs | 2 +- src/search_config.rs | 2 +- src/search_error.rs | 2 +- src/set.rs | 2 +- src/setting.rs | 2 +- src/settings.rs | 2 +- src/shell.rs | 2 +- src/show_whitespace.rs | 2 +- src/string_kind.rs | 2 +- src/string_literal.rs | 2 +- src/subcommand.rs | 2 +- src/suggestion.rs | 2 +- src/table.rs | 2 +- src/testing.rs | 2 +- src/thunk.rs | 2 +- src/token.rs | 2 +- src/token_kind.rs | 2 +- src/tree.rs | 2 +- src/unresolved_dependency.rs | 2 +- src/unresolved_recipe.rs | 2 +- src/variables.rs | 2 +- src/warning.rs | 2 +- tests/allow_duplicate_recipes.rs | 2 +- tests/assert_stdout.rs | 2 +- tests/assert_success.rs | 2 +- tests/byte_order_mark.rs | 2 +- tests/changelog.rs | 2 +- tests/choose.rs | 2 +- tests/command.rs | 2 +- tests/common.rs | 30 ------- tests/completions.rs | 2 +- tests/conditional.rs | 2 +- tests/delimiters.rs | 2 +- tests/dotenv.rs | 2 +- tests/edit.rs | 2 +- tests/equals.rs | 2 +- tests/error_messages.rs | 2 +- tests/evaluate.rs | 2 +- tests/examples.rs | 2 +- tests/fall_back_to_parent.rs | 2 +- tests/fmt.rs | 2 +- tests/functions.rs | 2 +- tests/init.rs | 2 +- tests/interrupts.rs | 135 +++++++++++++++---------------- tests/invocation_directory.rs | 2 +- tests/json.rs | 2 +- tests/lib.rs | 31 ++++++- tests/line_prefixes.rs | 2 +- tests/misc.rs | 2 +- tests/quiet.rs | 2 +- tests/quote.rs | 2 +- tests/readme.rs | 2 +- tests/regexes.rs | 2 +- tests/run.rs | 2 +- tests/search.rs | 2 +- tests/shell.rs | 2 +- tests/show.rs | 2 +- tests/string.rs | 2 +- tests/sublime_syntax.rs | 2 +- tests/subsequents.rs | 2 +- tests/test.rs | 2 +- tests/undefined_variables.rs | 2 +- tests/windows_powershell.rs | 2 +- tests/windows_shell.rs | 2 +- tests/working_directory.rs | 2 +- 119 files changed, 279 insertions(+), 301 deletions(-) delete mode 100644 src/common.rs delete mode 100644 tests/common.rs diff --git a/src/alias.rs b/src/alias.rs index e198e5a..f543abb 100644 --- a/src/alias.rs +++ b/src/alias.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; /// An alias, e.g. `name := target` #[derive(Debug, PartialEq, Clone, Serialize)] diff --git a/src/analyzer.rs b/src/analyzer.rs index 1f6d657..39e03a5 100644 --- a/src/analyzer.rs +++ b/src/analyzer.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; use CompileErrorKind::*; diff --git a/src/assignment.rs b/src/assignment.rs index 5ea7bc1..6dab1a9 100644 --- a/src/assignment.rs +++ b/src/assignment.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; /// An assignment, e.g `foo := bar` pub(crate) type Assignment<'src> = Binding<'src, Expression<'src>>; diff --git a/src/assignment_resolver.rs b/src/assignment_resolver.rs index 645ec84..3f07ba4 100644 --- a/src/assignment_resolver.rs +++ b/src/assignment_resolver.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; use CompileErrorKind::*; diff --git a/src/ast.rs b/src/ast.rs index 5dfe982..cca0f63 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; /// The top-level type produced by the parser. Not all successful parses result /// in valid justfiles, so additional consistency checks and name resolution diff --git a/src/binding.rs b/src/binding.rs index 77c1f9c..73b64c2 100644 --- a/src/binding.rs +++ b/src/binding.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; /// A binding of `name` to `value` #[derive(Debug, Clone, PartialEq, Serialize)] diff --git a/src/color.rs b/src/color.rs index faeea38..26cbca4 100644 --- a/src/color.rs +++ b/src/color.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; use ansi_term::{ANSIGenericString, Color::*, Prefix, Style, Suffix}; use atty::Stream; diff --git a/src/color_display.rs b/src/color_display.rs index b9eab60..4729621 100644 --- a/src/color_display.rs +++ b/src/color_display.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub(crate) trait ColorDisplay { fn color_display<'a>(&'a self, color: Color) -> Wrapper<'a> diff --git a/src/command_ext.rs b/src/command_ext.rs index f3ae879..a317e6f 100644 --- a/src/command_ext.rs +++ b/src/command_ext.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub(crate) trait CommandExt { fn export(&mut self, settings: &Settings, dotenv: &BTreeMap, scope: &Scope); diff --git a/src/common.rs b/src/common.rs deleted file mode 100644 index 678d759..0000000 --- a/src/common.rs +++ /dev/null @@ -1,86 +0,0 @@ -// stdlib -pub(crate) use std::{ - cmp, - collections::{BTreeMap, BTreeSet}, - env, - ffi::{OsStr, OsString}, - fmt::{self, Debug, Display, Formatter}, - fs, - io::{self, Cursor, Write}, - iter::{self, FromIterator}, - mem, - ops::{Index, Range, RangeInclusive}, - path::{self, Path, PathBuf}, - process::{self, Command, ExitStatus, Stdio}, - rc::Rc, - str::{self, Chars}, - sync::{Mutex, MutexGuard}, - usize, vec, -}; - -// dependencies -pub(crate) use ::{ - camino::Utf8Path, - derivative::Derivative, - edit_distance::edit_distance, - lexiclean::Lexiclean, - libc::EXIT_FAILURE, - log::{info, warn}, - regex::Regex, - serde::{ - ser::{SerializeMap, SerializeSeq}, - Serialize, Serializer, - }, - snafu::{ResultExt, Snafu}, - strum::{Display, EnumString, IntoStaticStr}, - typed_arena::Arena, - unicode_width::{UnicodeWidthChar, UnicodeWidthStr}, -}; - -// modules -pub(crate) use crate::{completions, config, config_error, keyed}; - -// functions -pub(crate) use crate::{load_dotenv::load_dotenv, output::output, unindent::unindent}; - -// traits -pub(crate) use crate::{ - color_display::ColorDisplay, command_ext::CommandExt, keyed::Keyed, ordinal::Ordinal, - platform_interface::PlatformInterface, range_ext::RangeExt, -}; - -// structs and enums -pub(crate) use crate::{ - alias::Alias, analyzer::Analyzer, assignment::Assignment, - assignment_resolver::AssignmentResolver, ast::Ast, binding::Binding, color::Color, - compile_error::CompileError, compile_error_kind::CompileErrorKind, - conditional_operator::ConditionalOperator, config::Config, config_error::ConfigError, - count::Count, delimiter::Delimiter, dependency::Dependency, dump_format::DumpFormat, - enclosure::Enclosure, error::Error, evaluator::Evaluator, expression::Expression, - fragment::Fragment, function::Function, function_context::FunctionContext, - interrupt_guard::InterruptGuard, interrupt_handler::InterruptHandler, item::Item, - justfile::Justfile, keyword::Keyword, lexer::Lexer, line::Line, list::List, loader::Loader, - name::Name, output_error::OutputError, parameter::Parameter, parameter_kind::ParameterKind, - parser::Parser, platform::Platform, position::Position, positional::Positional, recipe::Recipe, - recipe_context::RecipeContext, recipe_resolver::RecipeResolver, scope::Scope, search::Search, - search_config::SearchConfig, search_error::SearchError, set::Set, setting::Setting, - settings::Settings, shebang::Shebang, shell::Shell, show_whitespace::ShowWhitespace, - string_kind::StringKind, string_literal::StringLiteral, subcommand::Subcommand, - suggestion::Suggestion, table::Table, thunk::Thunk, token::Token, token_kind::TokenKind, - unresolved_dependency::UnresolvedDependency, unresolved_recipe::UnresolvedRecipe, - use_color::UseColor, variables::Variables, verbosity::Verbosity, warning::Warning, -}; - -// type aliases -pub(crate) type CompileResult<'a, T> = Result>; -pub(crate) type ConfigResult = Result; -pub(crate) type RunResult<'a, T> = Result>; -pub(crate) type SearchResult = Result; - -// modules used in tests -#[cfg(test)] -pub(crate) use crate::testing; - -// structs and enums used in tests -#[cfg(test)] -pub(crate) use crate::{node::Node, tree::Tree}; diff --git a/src/compile_error.rs b/src/compile_error.rs index 5fe4d3e..ba8d09e 100644 --- a/src/compile_error.rs +++ b/src/compile_error.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(Debug, PartialEq)] pub(crate) struct CompileError<'src> { diff --git a/src/compile_error_kind.rs b/src/compile_error_kind.rs index 76ba82c..062659b 100644 --- a/src/compile_error_kind.rs +++ b/src/compile_error_kind.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(Debug, PartialEq)] pub(crate) enum CompileErrorKind<'src> { diff --git a/src/compiler.rs b/src/compiler.rs index f19536e..2164856 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub(crate) struct Compiler; diff --git a/src/conditional_operator.rs b/src/conditional_operator.rs index 802be9f..bb297c2 100644 --- a/src/conditional_operator.rs +++ b/src/conditional_operator.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; /// A conditional expression operator. #[derive(PartialEq, Debug, Copy, Clone)] diff --git a/src/config.rs b/src/config.rs index 7dd6847..2a1085f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; use clap::{App, AppSettings, Arg, ArgGroup, ArgMatches, ArgSettings}; diff --git a/src/config_error.rs b/src/config_error.rs index af14c00..84f844a 100644 --- a/src/config_error.rs +++ b/src/config_error.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(Debug, Snafu)] #[snafu(visibility(pub(crate)), context(suffix(Context)))] diff --git a/src/count.rs b/src/count.rs index 84f52e6..b6504c9 100644 --- a/src/count.rs +++ b/src/count.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub struct Count(pub T, pub usize); diff --git a/src/dependency.rs b/src/dependency.rs index d3c470f..3039949 100644 --- a/src/dependency.rs +++ b/src/dependency.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(PartialEq, Debug, Serialize)] pub(crate) struct Dependency<'src> { diff --git a/src/enclosure.rs b/src/enclosure.rs index a9ac31a..12c715b 100644 --- a/src/enclosure.rs +++ b/src/enclosure.rs @@ -1,7 +1,7 @@ // `Self` cannot be used where type takes generic arguments #![allow(clippy::use_self)] -use crate::common::*; +use super::*; pub struct Enclosure { enclosure: &'static str, diff --git a/src/error.rs b/src/error.rs index c702549..e28a231 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(Debug)] pub(crate) enum Error<'src> { diff --git a/src/evaluator.rs b/src/evaluator.rs index 10aaba8..048828d 100644 --- a/src/evaluator.rs +++ b/src/evaluator.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub(crate) struct Evaluator<'src: 'run, 'run> { assignments: Option<&'run Table<'src, Assignment<'src>>>, diff --git a/src/expression.rs b/src/expression.rs index 8b84958..5b79268 100644 --- a/src/expression.rs +++ b/src/expression.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; /// An expression. Note that the Just language grammar has both an `expression` /// production of additions (`a + b`) and values, and a `value` production of diff --git a/src/fragment.rs b/src/fragment.rs index e4d73e3..04a6b9e 100644 --- a/src/fragment.rs +++ b/src/fragment.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; /// A line fragment consisting either of… #[derive(PartialEq, Debug, Clone)] diff --git a/src/function.rs b/src/function.rs index 7155098..6ea88f4 100644 --- a/src/function.rs +++ b/src/function.rs @@ -1,7 +1,7 @@ #![allow(unknown_lints)] #![allow(clippy::unnecessary_wraps)] -use crate::common::*; +use super::*; use Function::*; pub(crate) enum Function { diff --git a/src/function_context.rs b/src/function_context.rs index 3a5a435..986d3fe 100644 --- a/src/function_context.rs +++ b/src/function_context.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub(crate) struct FunctionContext<'run> { pub(crate) dotenv: &'run BTreeMap, diff --git a/src/fuzzing.rs b/src/fuzzing.rs index 54bba26..a1a2c13 100644 --- a/src/fuzzing.rs +++ b/src/fuzzing.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub(crate) fn compile(text: &str) { if let Err(error) = Parser::parse(text) { diff --git a/src/interrupt_guard.rs b/src/interrupt_guard.rs index 7f3faed..23afa1d 100644 --- a/src/interrupt_guard.rs +++ b/src/interrupt_guard.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub(crate) struct InterruptGuard; diff --git a/src/interrupt_handler.rs b/src/interrupt_handler.rs index a1eb18d..55f3e3a 100644 --- a/src/interrupt_handler.rs +++ b/src/interrupt_handler.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub(crate) struct InterruptHandler { blocks: u32, diff --git a/src/item.rs b/src/item.rs index 2e527c7..7bc8cf1 100644 --- a/src/item.rs +++ b/src/item.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; /// A single top-level item #[derive(Debug, Clone)] diff --git a/src/justfile.rs b/src/justfile.rs index 4dadb78..ccad90a 100644 --- a/src/justfile.rs +++ b/src/justfile.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; use serde::Serialize; diff --git a/src/keyed.rs b/src/keyed.rs index 79405f7..e171451 100644 --- a/src/keyed.rs +++ b/src/keyed.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub(crate) trait Keyed<'key> { fn key(&self) -> &'key str; diff --git a/src/keyword.rs b/src/keyword.rs index 11fdca1..2913e71 100644 --- a/src/keyword.rs +++ b/src/keyword.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(Debug, Eq, PartialEq, IntoStaticStr, Display, Copy, Clone, EnumString)] #[strum(serialize_all = "kebab_case")] diff --git a/src/lexer.rs b/src/lexer.rs index ee9751b..09a89d9 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; use CompileErrorKind::*; use TokenKind::*; diff --git a/src/lib.rs b/src/lib.rs index c758c5d..3a11a4f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,12 +14,81 @@ clippy::wildcard_imports )] +pub(crate) use { + crate::{ + alias::Alias, analyzer::Analyzer, assignment::Assignment, + assignment_resolver::AssignmentResolver, ast::Ast, binding::Binding, color::Color, + color_display::ColorDisplay, command_ext::CommandExt, compile_error::CompileError, + compile_error_kind::CompileErrorKind, conditional_operator::ConditionalOperator, + config::Config, config_error::ConfigError, count::Count, delimiter::Delimiter, + dependency::Dependency, dump_format::DumpFormat, enclosure::Enclosure, error::Error, + evaluator::Evaluator, expression::Expression, fragment::Fragment, function::Function, + function_context::FunctionContext, interrupt_guard::InterruptGuard, + interrupt_handler::InterruptHandler, item::Item, justfile::Justfile, keyed::Keyed, + keyword::Keyword, lexer::Lexer, line::Line, list::List, load_dotenv::load_dotenv, + loader::Loader, name::Name, ordinal::Ordinal, output::output, output_error::OutputError, + parameter::Parameter, parameter_kind::ParameterKind, parser::Parser, platform::Platform, + platform_interface::PlatformInterface, position::Position, positional::Positional, + range_ext::RangeExt, recipe::Recipe, recipe_context::RecipeContext, + recipe_resolver::RecipeResolver, scope::Scope, search::Search, search_config::SearchConfig, + search_error::SearchError, set::Set, setting::Setting, settings::Settings, shebang::Shebang, + shell::Shell, show_whitespace::ShowWhitespace, string_kind::StringKind, + string_literal::StringLiteral, subcommand::Subcommand, suggestion::Suggestion, table::Table, + thunk::Thunk, token::Token, token_kind::TokenKind, unresolved_dependency::UnresolvedDependency, + unresolved_recipe::UnresolvedRecipe, use_color::UseColor, variables::Variables, + verbosity::Verbosity, warning::Warning, + }, + std::{ + cmp, + collections::{BTreeMap, BTreeSet}, + env, + ffi::{OsStr, OsString}, + fmt::{self, Debug, Display, Formatter}, + fs, + io::{self, Cursor, Write}, + iter::{self, FromIterator}, + mem, + ops::{Index, Range, RangeInclusive}, + path::{self, Path, PathBuf}, + process::{self, Command, ExitStatus, Stdio}, + rc::Rc, + str::{self, Chars}, + sync::{Mutex, MutexGuard}, + usize, vec, + }, + { + camino::Utf8Path, + derivative::Derivative, + edit_distance::edit_distance, + lexiclean::Lexiclean, + libc::EXIT_FAILURE, + log::{info, warn}, + regex::Regex, + serde::{ + ser::{SerializeMap, SerializeSeq}, + Serialize, Serializer, + }, + snafu::{ResultExt, Snafu}, + strum::{Display, EnumString, IntoStaticStr}, + typed_arena::Arena, + unicode_width::{UnicodeWidthChar, UnicodeWidthStr}, + }, +}; + +#[cfg(test)] +pub(crate) use crate::{node::Node, tree::Tree}; + pub use crate::run::run; // Used in integration tests. #[doc(hidden)] pub use unindent::unindent; +pub(crate) type CompileResult<'a, T> = Result>; +pub(crate) type ConfigResult = Result; +pub(crate) type RunResult<'a, T> = Result>; +pub(crate) type SearchResult = Result; + #[macro_use] extern crate lazy_static; @@ -52,7 +121,6 @@ mod binding; mod color; mod color_display; mod command_ext; -mod common; mod compile_error; mod compile_error_kind; mod compiler; diff --git a/src/line.rs b/src/line.rs index 878cb8c..6f26506 100644 --- a/src/line.rs +++ b/src/line.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; /// A single line in a recipe body, consisting of any number of `Fragment`s. #[derive(Debug, Clone, PartialEq, Serialize)] diff --git a/src/list.rs b/src/list.rs index 36da9bc..f96167d 100644 --- a/src/list.rs +++ b/src/list.rs @@ -1,7 +1,7 @@ // `Self` cannot be used where type takes generic arguments #![allow(clippy::use_self)] -use crate::common::*; +use super::*; pub struct List + Clone> { conjunction: &'static str, diff --git a/src/load_dotenv.rs b/src/load_dotenv.rs index 74ec11b..b738e61 100644 --- a/src/load_dotenv.rs +++ b/src/load_dotenv.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; const DEFAULT_DOTENV_FILENAME: &str = ".env"; diff --git a/src/loader.rs b/src/loader.rs index 37bd1c8..95fa7c3 100644 --- a/src/loader.rs +++ b/src/loader.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub(crate) struct Loader { arena: Arena, diff --git a/src/name.rs b/src/name.rs index e9093b9..aec425f 100644 --- a/src/name.rs +++ b/src/name.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; /// A name. This is effectively just a `Token` of kind `Identifier`, but we give /// it its own type for clarity. diff --git a/src/node.rs b/src/node.rs index 539c355..02f6a00 100644 --- a/src/node.rs +++ b/src/node.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; /// Methods common to all AST nodes. Currently only used in parser unit tests. pub(crate) trait Node<'src> { diff --git a/src/output.rs b/src/output.rs index 8b5e2a3..f447ccc 100644 --- a/src/output.rs +++ b/src/output.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; /// Run a command and return the data it wrote to stdout as a string pub(crate) fn output(mut command: Command) -> Result { diff --git a/src/output_error.rs b/src/output_error.rs index 10e44a0..00d80af 100644 --- a/src/output_error.rs +++ b/src/output_error.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(Debug)] pub(crate) enum OutputError { diff --git a/src/parameter.rs b/src/parameter.rs index 257c83e..fb55d2c 100644 --- a/src/parameter.rs +++ b/src/parameter.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; /// A single function parameter #[derive(PartialEq, Debug, Clone, Serialize)] diff --git a/src/parameter_kind.rs b/src/parameter_kind.rs index 8651209..cc49cba 100644 --- a/src/parameter_kind.rs +++ b/src/parameter_kind.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; /// Parameters can either be… #[derive(Debug, Copy, Clone, Eq, PartialEq, Serialize)] diff --git a/src/parser.rs b/src/parser.rs index 9e94828..9f77de4 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; use TokenKind::*; diff --git a/src/platform.rs b/src/platform.rs index ad5b702..e84dcce 100644 --- a/src/platform.rs +++ b/src/platform.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub(crate) struct Platform; diff --git a/src/platform_interface.rs b/src/platform_interface.rs index 0d78edc..fcab222 100644 --- a/src/platform_interface.rs +++ b/src/platform_interface.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub(crate) trait PlatformInterface { /// Construct a command equivalent to running the script at `path` with the diff --git a/src/positional.rs b/src/positional.rs index 0c9d83c..79b318e 100644 --- a/src/positional.rs +++ b/src/positional.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; /// A struct containing the parsed representation of positional command-line /// arguments, i.e. arguments that are not flags, options, or the subcommand. diff --git a/src/range_ext.rs b/src/range_ext.rs index 325e5b9..2a96064 100644 --- a/src/range_ext.rs +++ b/src/range_ext.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub(crate) trait RangeExt { fn range_contains(&self, i: &T) -> bool; diff --git a/src/recipe.rs b/src/recipe.rs index 6a206e1..0b4ee36 100644 --- a/src/recipe.rs +++ b/src/recipe.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; use std::process::{ExitStatus, Stdio}; diff --git a/src/recipe_context.rs b/src/recipe_context.rs index 0c0dc34..b254440 100644 --- a/src/recipe_context.rs +++ b/src/recipe_context.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub(crate) struct RecipeContext<'src: 'run, 'run> { pub(crate) config: &'run Config, diff --git a/src/recipe_resolver.rs b/src/recipe_resolver.rs index cc8ad7d..dae0ba0 100644 --- a/src/recipe_resolver.rs +++ b/src/recipe_resolver.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; use CompileErrorKind::*; diff --git a/src/run.rs b/src/run.rs index 5a0f923..73be1b5 100644 --- a/src/run.rs +++ b/src/run.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub fn run() -> Result<(), i32> { #[cfg(windows)] diff --git a/src/scope.rs b/src/scope.rs index 9f1913a..f78ce57 100644 --- a/src/scope.rs +++ b/src/scope.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(Debug)] pub(crate) struct Scope<'src: 'run, 'run> { diff --git a/src/search.rs b/src/search.rs index eaf42f0..06cf1dd 100644 --- a/src/search.rs +++ b/src/search.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; use std::path::Component; diff --git a/src/search_config.rs b/src/search_config.rs index b9d4f9f..3af178a 100644 --- a/src/search_config.rs +++ b/src/search_config.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; /// Controls how `just` will search for the justfile. #[derive(Debug, PartialEq)] diff --git a/src/search_error.rs b/src/search_error.rs index 1dfabb2..3ee783e 100644 --- a/src/search_error.rs +++ b/src/search_error.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(Debug, Snafu)] #[snafu(visibility(pub(crate)))] diff --git a/src/set.rs b/src/set.rs index 0925b07..45e5808 100644 --- a/src/set.rs +++ b/src/set.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(Debug, Clone)] pub(crate) struct Set<'src> { diff --git a/src/setting.rs b/src/setting.rs index 3646347..6349cab 100644 --- a/src/setting.rs +++ b/src/setting.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(Debug, Clone)] pub(crate) enum Setting<'src> { diff --git a/src/settings.rs b/src/settings.rs index b6b7407..ae3767f 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub(crate) const DEFAULT_SHELL: &str = "sh"; pub(crate) const DEFAULT_SHELL_ARGS: &[&str] = &["-cu"]; diff --git a/src/shell.rs b/src/shell.rs index cc463c2..eebdfaa 100644 --- a/src/shell.rs +++ b/src/shell.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(Debug, Clone, PartialEq, Serialize)] pub(crate) struct Shell<'src> { diff --git a/src/show_whitespace.rs b/src/show_whitespace.rs index dd24f07..65c6902 100644 --- a/src/show_whitespace.rs +++ b/src/show_whitespace.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; /// String wrapper that uses nonblank characters to display spaces and tabs pub struct ShowWhitespace<'str>(pub &'str str); diff --git a/src/string_kind.rs b/src/string_kind.rs index 07bd23b..edfbe46 100644 --- a/src/string_kind.rs +++ b/src/string_kind.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(Debug, PartialEq, Clone, Copy, Ord, PartialOrd, Eq)] pub(crate) struct StringKind { diff --git a/src/string_literal.rs b/src/string_literal.rs index 272642b..47459cf 100644 --- a/src/string_literal.rs +++ b/src/string_literal.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(PartialEq, Debug, Clone)] pub(crate) struct StringLiteral<'src> { diff --git a/src/subcommand.rs b/src/subcommand.rs index eabb233..ea7e9e5 100644 --- a/src/subcommand.rs +++ b/src/subcommand.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; const INIT_JUSTFILE: &str = "default:\n echo 'Hello, world!'\n"; diff --git a/src/suggestion.rs b/src/suggestion.rs index 41eeced..7db586a 100644 --- a/src/suggestion.rs +++ b/src/suggestion.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(Clone, Copy, Debug, PartialEq)] pub(crate) struct Suggestion<'src> { diff --git a/src/table.rs b/src/table.rs index dfc2eac..12ce40b 100644 --- a/src/table.rs +++ b/src/table.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; use std::collections::btree_map; diff --git a/src/testing.rs b/src/testing.rs index caeaa1e..121f15f 100644 --- a/src/testing.rs +++ b/src/testing.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; use crate::compiler::Compiler; use pretty_assertions::assert_eq; diff --git a/src/thunk.rs b/src/thunk.rs index f18c389..14206f8 100644 --- a/src/thunk.rs +++ b/src/thunk.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(Derivative)] #[derivative(Debug, Clone, PartialEq = "feature_allow_slow_enum")] diff --git a/src/token.rs b/src/token.rs index 62190bd..d86cef6 100644 --- a/src/token.rs +++ b/src/token.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(Debug, PartialEq, Clone, Copy)] pub(crate) struct Token<'src> { diff --git a/src/token_kind.rs b/src/token_kind.rs index 79139bb..c36edf5 100644 --- a/src/token_kind.rs +++ b/src/token_kind.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(Debug, PartialEq, Clone, Copy, Ord, PartialOrd, Eq)] pub(crate) enum TokenKind { diff --git a/src/tree.rs b/src/tree.rs index 99f67aa..d72d0f9 100644 --- a/src/tree.rs +++ b/src/tree.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; use std::{borrow::Cow, mem}; diff --git a/src/unresolved_dependency.rs b/src/unresolved_dependency.rs index 47a9e9a..cbe880e 100644 --- a/src/unresolved_dependency.rs +++ b/src/unresolved_dependency.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(PartialEq, Debug, Clone)] pub(crate) struct UnresolvedDependency<'src> { diff --git a/src/unresolved_recipe.rs b/src/unresolved_recipe.rs index 649d8f5..81f689b 100644 --- a/src/unresolved_recipe.rs +++ b/src/unresolved_recipe.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub(crate) type UnresolvedRecipe<'src> = Recipe<'src, UnresolvedDependency<'src>>; diff --git a/src/variables.rs b/src/variables.rs index e56a278..1b634df 100644 --- a/src/variables.rs +++ b/src/variables.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub(crate) struct Variables<'expression, 'src> { stack: Vec<&'expression Expression<'src>>, diff --git a/src/warning.rs b/src/warning.rs index cfb11a4..9d6c053 100644 --- a/src/warning.rs +++ b/src/warning.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[derive(Clone, Debug, PartialEq)] pub(crate) enum Warning {} diff --git a/tests/allow_duplicate_recipes.rs b/tests/allow_duplicate_recipes.rs index d597ce0..9e873e4 100644 --- a/tests/allow_duplicate_recipes.rs +++ b/tests/allow_duplicate_recipes.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[test] fn allow_duplicate_recipes() { diff --git a/tests/assert_stdout.rs b/tests/assert_stdout.rs index 05f2b9b..dd1b2d5 100644 --- a/tests/assert_stdout.rs +++ b/tests/assert_stdout.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub(crate) fn assert_stdout(output: &Output, stdout: &str) { assert_success(output); diff --git a/tests/assert_success.rs b/tests/assert_success.rs index 0f4ddab..3026b67 100644 --- a/tests/assert_success.rs +++ b/tests/assert_success.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; pub(crate) fn assert_success(output: &Output) { if !output.status.success() { diff --git a/tests/byte_order_mark.rs b/tests/byte_order_mark.rs index 676aefa..906f49d 100644 --- a/tests/byte_order_mark.rs +++ b/tests/byte_order_mark.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[test] fn ignore_leading_byte_order_mark() { diff --git a/tests/changelog.rs b/tests/changelog.rs index 8553535..73fc0ff 100644 --- a/tests/changelog.rs +++ b/tests/changelog.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[test] fn print_changelog() { diff --git a/tests/choose.rs b/tests/choose.rs index 8f094ff..6444f2a 100644 --- a/tests/choose.rs +++ b/tests/choose.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; test! { name: env, diff --git a/tests/command.rs b/tests/command.rs index 4da4393..47cd039 100644 --- a/tests/command.rs +++ b/tests/command.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; test! { name: long, diff --git a/tests/common.rs b/tests/common.rs deleted file mode 100644 index 1915197..0000000 --- a/tests/common.rs +++ /dev/null @@ -1,30 +0,0 @@ -pub(crate) use std::{ - collections::BTreeMap, - env::{self, consts::EXE_SUFFIX}, - error::Error, - fmt::Debug, - fs, - io::Write, - iter, - path::{Path, PathBuf, MAIN_SEPARATOR}, - process::{Command, Output, Stdio}, - str, -}; - -pub(crate) use ::{ - cradle::input::Input, - executable_path::executable_path, - just::unindent, - libc::{EXIT_FAILURE, EXIT_SUCCESS}, - pretty_assertions::Comparison, - regex::Regex, - serde_json::{json, Value}, - tempfile::TempDir, - temptree::{temptree, tree, Tree}, - which::which, - yaml_rust::YamlLoader, -}; - -pub(crate) use crate::{ - assert_stdout::assert_stdout, assert_success::assert_success, tempdir::tempdir, test::Test, -}; diff --git a/tests/completions.rs b/tests/completions.rs index 7913238..2f33d2a 100644 --- a/tests/completions.rs +++ b/tests/completions.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[test] fn output() { diff --git a/tests/conditional.rs b/tests/conditional.rs index a9bec9f..3784a03 100644 --- a/tests/conditional.rs +++ b/tests/conditional.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; test! { name: then_branch_unevaluated, diff --git a/tests/delimiters.rs b/tests/delimiters.rs index 638ca5e..ab032e6 100644 --- a/tests/delimiters.rs +++ b/tests/delimiters.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; test! { name: mismatched_delimiter, diff --git a/tests/dotenv.rs b/tests/dotenv.rs index e068532..257a2d6 100644 --- a/tests/dotenv.rs +++ b/tests/dotenv.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[test] fn dotenv() { diff --git a/tests/edit.rs b/tests/edit.rs index e1199a5..c7d72c7 100644 --- a/tests/edit.rs +++ b/tests/edit.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; const JUSTFILE: &str = "Yooooooo, hopefully this never becomes valid syntax."; diff --git a/tests/equals.rs b/tests/equals.rs index 476cea6..7c781f2 100644 --- a/tests/equals.rs +++ b/tests/equals.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[test] fn export_recipe() { diff --git a/tests/error_messages.rs b/tests/error_messages.rs index 108d376..54b93d0 100644 --- a/tests/error_messages.rs +++ b/tests/error_messages.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; test! { name: expected_keyword, diff --git a/tests/evaluate.rs b/tests/evaluate.rs index 412314b..22fa746 100644 --- a/tests/evaluate.rs +++ b/tests/evaluate.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; test! { name: evaluate, diff --git a/tests/examples.rs b/tests/examples.rs index 9d3e272..dd7eee9 100644 --- a/tests/examples.rs +++ b/tests/examples.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[test] fn examples() { diff --git a/tests/fall_back_to_parent.rs b/tests/fall_back_to_parent.rs index 74351a1..af6ee4f 100644 --- a/tests/fall_back_to_parent.rs +++ b/tests/fall_back_to_parent.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[test] fn runs_recipe_in_parent_if_not_found_in_current() { diff --git a/tests/fmt.rs b/tests/fmt.rs index 9da74ed..e4c4687 100644 --- a/tests/fmt.rs +++ b/tests/fmt.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; test! { name: unstable_not_passed, diff --git a/tests/functions.rs b/tests/functions.rs index e5f8d35..327abe7 100644 --- a/tests/functions.rs +++ b/tests/functions.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; test! { name: test_os_arch_functions_in_interpolation, diff --git a/tests/init.rs b/tests/init.rs index 2788886..955f51d 100644 --- a/tests/init.rs +++ b/tests/init.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; const EXPECTED: &str = "default:\n echo 'Hello, world!'\n"; diff --git a/tests/interrupts.rs b/tests/interrupts.rs index 9842d86..44b2d71 100644 --- a/tests/interrupts.rs +++ b/tests/interrupts.rs @@ -1,90 +1,87 @@ -#[cfg(unix)] -mod unix { - use crate::common::*; +use super::*; - use std::time::{Duration, Instant}; +use std::time::{Duration, Instant}; - fn kill(process_id: u32) { - unsafe { - libc::kill(process_id as i32, libc::SIGINT); - } +fn kill(process_id: u32) { + unsafe { + libc::kill(process_id as i32, libc::SIGINT); + } +} + +fn interrupt_test(arguments: &[&str], justfile: &str) { + let tmp = tempdir(); + let mut justfile_path = tmp.path().to_path_buf(); + justfile_path.push("justfile"); + fs::write(justfile_path, unindent(justfile)).unwrap(); + + let start = Instant::now(); + + let mut child = Command::new(&executable_path("just")) + .current_dir(&tmp) + .args(arguments) + .spawn() + .expect("just invocation failed"); + + while start.elapsed() < Duration::from_millis(500) {} + + kill(child.id()); + + let status = child.wait().unwrap(); + + let elapsed = start.elapsed(); + + if elapsed > Duration::from_secs(2) { + panic!("process returned too late: {:?}", elapsed); } - fn interrupt_test(arguments: &[&str], justfile: &str) { - let tmp = tempdir(); - let mut justfile_path = tmp.path().to_path_buf(); - justfile_path.push("justfile"); - fs::write(justfile_path, unindent(justfile)).unwrap(); - - let start = Instant::now(); - - let mut child = Command::new(&executable_path("just")) - .current_dir(&tmp) - .args(arguments) - .spawn() - .expect("just invocation failed"); - - while start.elapsed() < Duration::from_millis(500) {} - - kill(child.id()); - - let status = child.wait().unwrap(); - - let elapsed = start.elapsed(); - - if elapsed > Duration::from_secs(2) { - panic!("process returned too late: {:?}", elapsed); - } - - if elapsed < Duration::from_millis(100) { - panic!("process returned too early : {:?}", elapsed); - } - - assert_eq!(status.code(), Some(130)); + if elapsed < Duration::from_millis(100) { + panic!("process returned too early : {:?}", elapsed); } - #[test] - #[ignore] - fn interrupt_shebang() { - interrupt_test( - &[], - " + assert_eq!(status.code(), Some(130)); +} + +#[test] +#[ignore] +fn interrupt_shebang() { + interrupt_test( + &[], + " default: #!/usr/bin/env sh sleep 1 ", - ); - } + ); +} - #[test] - #[ignore] - fn interrupt_line() { - interrupt_test( - &[], - " +#[test] +#[ignore] +fn interrupt_line() { + interrupt_test( + &[], + " default: @sleep 1 ", - ); - } + ); +} - #[test] - #[ignore] - fn interrupt_backtick() { - interrupt_test( - &[], - " +#[test] +#[ignore] +fn interrupt_backtick() { + interrupt_test( + &[], + " foo := `sleep 1` default: @echo {{foo}} ", - ); - } - - #[test] - #[ignore] - fn interrupt_command() { - interrupt_test(&["--command", "sleep", "1"], ""); - } + ); +} + +#[test] +#[ignore] +fn interrupt_command() { + interrupt_test(&["--command", "sleep", "1"], ""); } diff --git a/tests/invocation_directory.rs b/tests/invocation_directory.rs index 1215bc2..b45e05e 100644 --- a/tests/invocation_directory.rs +++ b/tests/invocation_directory.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[cfg(unix)] fn convert_native_path(path: &Path) -> String { diff --git a/tests/json.rs b/tests/json.rs index 308b1cc..e312111 100644 --- a/tests/json.rs +++ b/tests/json.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; fn test(justfile: &str, value: Value) { Test::new() diff --git a/tests/lib.rs b/tests/lib.rs index 4f2f424..f507679 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -1,3 +1,32 @@ +pub(crate) use { + crate::{ + assert_stdout::assert_stdout, assert_success::assert_success, tempdir::tempdir, test::Test, + }, + cradle::input::Input, + executable_path::executable_path, + just::unindent, + libc::{EXIT_FAILURE, EXIT_SUCCESS}, + pretty_assertions::Comparison, + regex::Regex, + serde_json::{json, Value}, + std::{ + collections::BTreeMap, + env::{self, consts::EXE_SUFFIX}, + error::Error, + fmt::Debug, + fs, + io::Write, + iter, + path::{Path, PathBuf, MAIN_SEPARATOR}, + process::{Command, Output, Stdio}, + str, + }, + tempfile::TempDir, + temptree::{temptree, tree, Tree}, + which::which, + yaml_rust::YamlLoader, +}; + #[macro_use] mod test; @@ -8,7 +37,6 @@ mod byte_order_mark; mod changelog; mod choose; mod command; -mod common; mod completions; mod conditional; mod delimiters; @@ -23,6 +51,7 @@ mod fall_back_to_parent; mod fmt; mod functions; mod init; +#[cfg(unix)] mod interrupts; mod invocation_directory; mod json; diff --git a/tests/line_prefixes.rs b/tests/line_prefixes.rs index c1fd510..f98d6c5 100644 --- a/tests/line_prefixes.rs +++ b/tests/line_prefixes.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[test] fn infallible_after_quiet() { diff --git a/tests/misc.rs b/tests/misc.rs index cdf14e9..1c5ef20 100644 --- a/tests/misc.rs +++ b/tests/misc.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; test! { name: alias_listing, diff --git a/tests/quiet.rs b/tests/quiet.rs index 3a2a766..d906d9e 100644 --- a/tests/quiet.rs +++ b/tests/quiet.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; test! { name: no_stdout, diff --git a/tests/quote.rs b/tests/quote.rs index 4cbdc94..bc6afc4 100644 --- a/tests/quote.rs +++ b/tests/quote.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[test] fn single_quotes_are_prepended_and_appended() { diff --git a/tests/readme.rs b/tests/readme.rs index dacb8f4..2c32014 100644 --- a/tests/readme.rs +++ b/tests/readme.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[test] fn readme() { diff --git a/tests/regexes.rs b/tests/regexes.rs index c39045e..7a53a0a 100644 --- a/tests/regexes.rs +++ b/tests/regexes.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[test] fn match_succeeds_evaluates_to_first_branch() { diff --git a/tests/run.rs b/tests/run.rs index 2d7d7d3..bad51f8 100644 --- a/tests/run.rs +++ b/tests/run.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[test] fn dont_run_duplicate_recipes() { diff --git a/tests/search.rs b/tests/search.rs index 425ba8d..395f3a9 100644 --- a/tests/search.rs +++ b/tests/search.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; fn search_test>(path: P, args: &[&str]) { let binary = executable_path("just"); diff --git a/tests/shell.rs b/tests/shell.rs index fb2e00e..30396e4 100644 --- a/tests/shell.rs +++ b/tests/shell.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; const JUSTFILE: &str = " expression := `EXPRESSION` diff --git a/tests/show.rs b/tests/show.rs index 309e53a..9138489 100644 --- a/tests/show.rs +++ b/tests/show.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; test! { name: show, diff --git a/tests/string.rs b/tests/string.rs index d1ad12b..a7e0894 100644 --- a/tests/string.rs +++ b/tests/string.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; test! { name: raw_string, diff --git a/tests/sublime_syntax.rs b/tests/sublime_syntax.rs index fb2a7de..040b434 100644 --- a/tests/sublime_syntax.rs +++ b/tests/sublime_syntax.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[test] fn parse() { diff --git a/tests/subsequents.rs b/tests/subsequents.rs index 36230b9..10fa25a 100644 --- a/tests/subsequents.rs +++ b/tests/subsequents.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; test! { name: success, diff --git a/tests/test.rs b/tests/test.rs index a126fb5..a890930 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; use pretty_assertions::assert_eq; diff --git a/tests/undefined_variables.rs b/tests/undefined_variables.rs index 0026253..be982aa 100644 --- a/tests/undefined_variables.rs +++ b/tests/undefined_variables.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[test] fn parameter_default_unknown_variable_in_expression() { diff --git a/tests/windows_powershell.rs b/tests/windows_powershell.rs index 79ea0b3..1a450bd 100644 --- a/tests/windows_powershell.rs +++ b/tests/windows_powershell.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[test] fn windows_poweshell_setting_uses_powershell() { diff --git a/tests/windows_shell.rs b/tests/windows_shell.rs index db0a93a..7db6988 100644 --- a/tests/windows_shell.rs +++ b/tests/windows_shell.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; #[test] fn windows_shell_setting() { diff --git a/tests/working_directory.rs b/tests/working_directory.rs index c43252e..28e5ffd 100644 --- a/tests/working_directory.rs +++ b/tests/working_directory.rs @@ -1,4 +1,4 @@ -use crate::common::*; +use super::*; const JUSTFILE: &str = r#" foo := `cat data`