Skip to content

Commit 01fae9b

Browse files
authored
Do use super::*; instead of use crate::common::*; (#1239)
1 parent 180672b commit 01fae9b

File tree

119 files changed

+270
-292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+270
-292
lines changed

src/alias.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
/// An alias, e.g. `name := target`
44
#[derive(Debug, PartialEq, Clone, Serialize)]

src/analyzer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
use CompileErrorKind::*;
44

src/assignment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
/// An assignment, e.g `foo := bar`
44
pub(crate) type Assignment<'src> = Binding<'src, Expression<'src>>;

src/assignment_resolver.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
use CompileErrorKind::*;
44

src/ast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
/// The top-level type produced by the parser. Not all successful parses result
44
/// in valid justfiles, so additional consistency checks and name resolution

src/binding.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
/// A binding of `name` to `value`
44
#[derive(Debug, Clone, PartialEq, Serialize)]

src/color.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
use ansi_term::{ANSIGenericString, Color::*, Prefix, Style, Suffix};
44
use atty::Stream;

src/color_display.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
pub(crate) trait ColorDisplay {
44
fn color_display<'a>(&'a self, color: Color) -> Wrapper<'a>

src/command_ext.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
pub(crate) trait CommandExt {
44
fn export(&mut self, settings: &Settings, dotenv: &BTreeMap<String, String>, scope: &Scope);

src/common.rs

-86
This file was deleted.

src/compile_error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
#[derive(Debug, PartialEq)]
44
pub(crate) struct CompileError<'src> {

src/compile_error_kind.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
#[derive(Debug, PartialEq)]
44
pub(crate) enum CompileErrorKind<'src> {

src/compiler.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
pub(crate) struct Compiler;
44

src/conditional_operator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
/// A conditional expression operator.
44
#[derive(PartialEq, Debug, Copy, Clone)]

src/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
use clap::{App, AppSettings, Arg, ArgGroup, ArgMatches, ArgSettings};
44

src/config_error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
#[derive(Debug, Snafu)]
44
#[snafu(visibility(pub(crate)), context(suffix(Context)))]

src/count.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
pub struct Count<T: Display>(pub T, pub usize);
44

src/dependency.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
#[derive(PartialEq, Debug, Serialize)]
44
pub(crate) struct Dependency<'src> {

src/enclosure.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// `Self` cannot be used where type takes generic arguments
22
#![allow(clippy::use_self)]
33

4-
use crate::common::*;
4+
use super::*;
55

66
pub struct Enclosure<T: Display> {
77
enclosure: &'static str,

src/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
#[derive(Debug)]
44
pub(crate) enum Error<'src> {

src/evaluator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
pub(crate) struct Evaluator<'src: 'run, 'run> {
44
assignments: Option<&'run Table<'src, Assignment<'src>>>,

src/expression.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
/// An expression. Note that the Just language grammar has both an `expression`
44
/// production of additions (`a + b`) and values, and a `value` production of

src/fragment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
/// A line fragment consisting either of…
44
#[derive(PartialEq, Debug, Clone)]

src/function.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![allow(unknown_lints)]
22
#![allow(clippy::unnecessary_wraps)]
33

4-
use crate::common::*;
4+
use super::*;
55

66
use Function::*;
77
pub(crate) enum Function {

src/function_context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
pub(crate) struct FunctionContext<'run> {
44
pub(crate) dotenv: &'run BTreeMap<String, String>,

src/fuzzing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
pub(crate) fn compile(text: &str) {
44
if let Err(error) = Parser::parse(text) {

src/interrupt_guard.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
pub(crate) struct InterruptGuard;
44

src/interrupt_handler.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
pub(crate) struct InterruptHandler {
44
blocks: u32,

src/item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
/// A single top-level item
44
#[derive(Debug, Clone)]

src/justfile.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
use serde::Serialize;
44

src/keyed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
pub(crate) trait Keyed<'key> {
44
fn key(&self) -> &'key str;

src/keyword.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
#[derive(Debug, Eq, PartialEq, IntoStaticStr, Display, Copy, Clone, EnumString)]
44
#[strum(serialize_all = "kebab_case")]

src/lexer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
use CompileErrorKind::*;
44
use TokenKind::*;

src/lib.rs

+69-1
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,81 @@
1414
clippy::wildcard_imports
1515
)]
1616

17+
pub(crate) use {
18+
crate::{
19+
alias::Alias, analyzer::Analyzer, assignment::Assignment,
20+
assignment_resolver::AssignmentResolver, ast::Ast, binding::Binding, color::Color,
21+
color_display::ColorDisplay, command_ext::CommandExt, compile_error::CompileError,
22+
compile_error_kind::CompileErrorKind, conditional_operator::ConditionalOperator,
23+
config::Config, config_error::ConfigError, count::Count, delimiter::Delimiter,
24+
dependency::Dependency, dump_format::DumpFormat, enclosure::Enclosure, error::Error,
25+
evaluator::Evaluator, expression::Expression, fragment::Fragment, function::Function,
26+
function_context::FunctionContext, interrupt_guard::InterruptGuard,
27+
interrupt_handler::InterruptHandler, item::Item, justfile::Justfile, keyed::Keyed,
28+
keyword::Keyword, lexer::Lexer, line::Line, list::List, load_dotenv::load_dotenv,
29+
loader::Loader, name::Name, ordinal::Ordinal, output::output, output_error::OutputError,
30+
parameter::Parameter, parameter_kind::ParameterKind, parser::Parser, platform::Platform,
31+
platform_interface::PlatformInterface, position::Position, positional::Positional,
32+
range_ext::RangeExt, recipe::Recipe, recipe_context::RecipeContext,
33+
recipe_resolver::RecipeResolver, scope::Scope, search::Search, search_config::SearchConfig,
34+
search_error::SearchError, set::Set, setting::Setting, settings::Settings, shebang::Shebang,
35+
shell::Shell, show_whitespace::ShowWhitespace, string_kind::StringKind,
36+
string_literal::StringLiteral, subcommand::Subcommand, suggestion::Suggestion, table::Table,
37+
thunk::Thunk, token::Token, token_kind::TokenKind, unresolved_dependency::UnresolvedDependency,
38+
unresolved_recipe::UnresolvedRecipe, use_color::UseColor, variables::Variables,
39+
verbosity::Verbosity, warning::Warning,
40+
},
41+
std::{
42+
cmp,
43+
collections::{BTreeMap, BTreeSet},
44+
env,
45+
ffi::{OsStr, OsString},
46+
fmt::{self, Debug, Display, Formatter},
47+
fs,
48+
io::{self, Cursor, Write},
49+
iter::{self, FromIterator},
50+
mem,
51+
ops::{Index, Range, RangeInclusive},
52+
path::{self, Path, PathBuf},
53+
process::{self, Command, ExitStatus, Stdio},
54+
rc::Rc,
55+
str::{self, Chars},
56+
sync::{Mutex, MutexGuard},
57+
usize, vec,
58+
},
59+
{
60+
camino::Utf8Path,
61+
derivative::Derivative,
62+
edit_distance::edit_distance,
63+
lexiclean::Lexiclean,
64+
libc::EXIT_FAILURE,
65+
log::{info, warn},
66+
regex::Regex,
67+
serde::{
68+
ser::{SerializeMap, SerializeSeq},
69+
Serialize, Serializer,
70+
},
71+
snafu::{ResultExt, Snafu},
72+
strum::{Display, EnumString, IntoStaticStr},
73+
typed_arena::Arena,
74+
unicode_width::{UnicodeWidthChar, UnicodeWidthStr},
75+
},
76+
};
77+
78+
#[cfg(test)]
79+
pub(crate) use crate::{node::Node, tree::Tree};
80+
1781
pub use crate::run::run;
1882

1983
// Used in integration tests.
2084
#[doc(hidden)]
2185
pub use unindent::unindent;
2286

87+
pub(crate) type CompileResult<'a, T> = Result<T, CompileError<'a>>;
88+
pub(crate) type ConfigResult<T> = Result<T, ConfigError>;
89+
pub(crate) type RunResult<'a, T> = Result<T, Error<'a>>;
90+
pub(crate) type SearchResult<T> = Result<T, SearchError>;
91+
2392
#[macro_use]
2493
extern crate lazy_static;
2594

@@ -52,7 +121,6 @@ mod binding;
52121
mod color;
53122
mod color_display;
54123
mod command_ext;
55-
mod common;
56124
mod compile_error;
57125
mod compile_error_kind;
58126
mod compiler;

src/line.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
/// A single line in a recipe body, consisting of any number of `Fragment`s.
44
#[derive(Debug, Clone, PartialEq, Serialize)]

src/list.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// `Self` cannot be used where type takes generic arguments
22
#![allow(clippy::use_self)]
33

4-
use crate::common::*;
4+
use super::*;
55

66
pub struct List<T: Display, I: Iterator<Item = T> + Clone> {
77
conjunction: &'static str,

src/load_dotenv.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::*;
1+
use super::*;
22

33
const DEFAULT_DOTENV_FILENAME: &str = ".env";
44

0 commit comments

Comments
 (0)