Remove trailing whitespace (#167)
This commit is contained in:
parent
e45164da4d
commit
435b4c5ea3
@ -252,7 +252,7 @@ c: b
|
||||
|
||||
#[test]
|
||||
fn summary() {
|
||||
let text =
|
||||
let text =
|
||||
"b: a
|
||||
a:
|
||||
d: c
|
||||
@ -268,7 +268,7 @@ c: b";
|
||||
|
||||
#[test]
|
||||
fn select() {
|
||||
let text =
|
||||
let text =
|
||||
"b:
|
||||
@echo b
|
||||
a:
|
||||
@ -288,7 +288,7 @@ c:
|
||||
|
||||
#[test]
|
||||
fn print() {
|
||||
let text =
|
||||
let text =
|
||||
"b:
|
||||
echo b
|
||||
a:
|
||||
@ -309,7 +309,7 @@ c:
|
||||
|
||||
#[test]
|
||||
fn show() {
|
||||
let text =
|
||||
let text =
|
||||
r#"hello = "foo"
|
||||
bar = hello + hello
|
||||
recipe:
|
||||
@ -327,7 +327,7 @@ recipe:
|
||||
|
||||
#[test]
|
||||
fn status_passthrough() {
|
||||
let text =
|
||||
let text =
|
||||
"
|
||||
|
||||
hello:
|
||||
|
24
src/lib.rs
24
src/lib.rs
@ -494,7 +494,7 @@ impl<'a> Display for Recipe<'a> {
|
||||
}
|
||||
match *piece {
|
||||
Fragment::Text{ref text} => write!(f, "{}", text.lexeme)?,
|
||||
Fragment::Expression{ref expression, ..} =>
|
||||
Fragment::Expression{ref expression, ..} =>
|
||||
write!(f, "{}{}{}", "{{", expression, "}}")?,
|
||||
}
|
||||
}
|
||||
@ -517,7 +517,7 @@ fn resolve_recipes<'a>(
|
||||
resolved: empty(),
|
||||
recipes: recipes,
|
||||
};
|
||||
|
||||
|
||||
for recipe in recipes.values() {
|
||||
resolver.resolve(recipe)?;
|
||||
resolver.seen = empty();
|
||||
@ -529,7 +529,7 @@ fn resolve_recipes<'a>(
|
||||
if let Fragment::Expression{ref expression, ..} = *fragment {
|
||||
for variable in expression.variables() {
|
||||
let name = variable.lexeme;
|
||||
let undefined = !assignments.contains_key(name)
|
||||
let undefined = !assignments.contains_key(name)
|
||||
&& !recipe.parameters.iter().any(|p| p.name == name);
|
||||
if undefined {
|
||||
// There's a borrow issue here that seems too difficult to solve.
|
||||
@ -738,7 +738,7 @@ impl<'a, 'b> Evaluator<'a, 'b> {
|
||||
self.evaluated.insert(name, value);
|
||||
}
|
||||
} else {
|
||||
return Err(RunError::InternalError {
|
||||
return Err(RunError::InternalError {
|
||||
message: format!("attempted to evaluated unknown assignment {}", name)
|
||||
});
|
||||
}
|
||||
@ -763,7 +763,7 @@ impl<'a, 'b> Evaluator<'a, 'b> {
|
||||
} else if arguments.contains_key(name) {
|
||||
arguments[name].to_string()
|
||||
} else {
|
||||
return Err(RunError::InternalError {
|
||||
return Err(RunError::InternalError {
|
||||
message: format!("attempted to evaluate undefined variable `{}`", name)
|
||||
});
|
||||
}
|
||||
@ -1048,7 +1048,7 @@ impl<'a> Display for CompileError<'a> {
|
||||
let bold = maybe_bold(f.alternate());
|
||||
|
||||
write!(f, "{} {}", red.paint("error:"), bold.prefix())?;
|
||||
|
||||
|
||||
match self.kind {
|
||||
CircularRecipeDependency{recipe, ref circle} => {
|
||||
if circle.len() == 2 {
|
||||
@ -1639,8 +1639,8 @@ fn tokenize(text: &str) -> Result<Vec<Token>, CompileError> {
|
||||
});
|
||||
}
|
||||
|
||||
let (prefix, lexeme, kind) =
|
||||
if let (0, &State::Indent(indent), Some(captures)) =
|
||||
let (prefix, lexeme, kind) =
|
||||
if let (0, &State::Indent(indent), Some(captures)) =
|
||||
(column, state.last().unwrap(), LINE.captures(rest)) {
|
||||
let line = captures.at(0).unwrap();
|
||||
if !line.starts_with(indent) {
|
||||
@ -1677,7 +1677,7 @@ fn tokenize(text: &str) -> Result<Vec<Token>, CompileError> {
|
||||
(captures.at(1).unwrap(), captures.at(2).unwrap(), Name)
|
||||
} else if let Some(captures) = EOL.captures(rest) {
|
||||
if state.last().unwrap() == &State::Interpolation {
|
||||
return error!(ErrorKind::InternalError {
|
||||
return error!(ErrorKind::InternalError {
|
||||
message: "hit EOL while still in interpolation state".to_string()
|
||||
});
|
||||
}
|
||||
@ -1706,7 +1706,7 @@ fn tokenize(text: &str) -> Result<Vec<Token>, CompileError> {
|
||||
}
|
||||
let mut len = 0;
|
||||
let mut escape = false;
|
||||
for c in contents.chars() {
|
||||
for c in contents.chars() {
|
||||
if c == '\n' || c == '\r' {
|
||||
return error!(ErrorKind::UnterminatedString);
|
||||
} else if !escape && c == '"' {
|
||||
@ -1901,7 +1901,7 @@ impl<'a> Parser<'a> {
|
||||
recipe: name.lexeme, parameter: parameter.lexeme
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
let default;
|
||||
if self.accepted(Equals) {
|
||||
if let Some(string) = self.accept_any(&[StringToken, RawString]) {
|
||||
@ -1981,7 +1981,7 @@ impl<'a> Parser<'a> {
|
||||
if token.lexeme.starts_with("#!") {
|
||||
shebang = true;
|
||||
}
|
||||
} else if !shebang
|
||||
} else if !shebang
|
||||
&& !lines.last().and_then(|line| line.last())
|
||||
.map(Fragment::continuation).unwrap_or(false)
|
||||
&& (token.lexeme.starts_with(' ') || token.lexeme.starts_with('\t')) {
|
||||
|
10
src/unit.rs
10
src/unit.rs
@ -378,7 +378,7 @@ fn parse_assignments() {
|
||||
r#"a = "0"
|
||||
c = a + b + a + b
|
||||
b = "1"
|
||||
"#,
|
||||
"#,
|
||||
|
||||
r#"a = "0"
|
||||
|
||||
@ -392,7 +392,7 @@ fn parse_assignment_backticks() {
|
||||
parse_summary(
|
||||
"a = `echo hello`
|
||||
c = a + b + a + b
|
||||
b = `echo goodbye`",
|
||||
b = `echo goodbye`",
|
||||
|
||||
"a = `echo hello`
|
||||
|
||||
@ -405,9 +405,9 @@ c = a + b + a + b");
|
||||
fn parse_interpolation_backticks() {
|
||||
parse_summary(
|
||||
r#"a:
|
||||
echo {{ `echo hello` + "blarg" }} {{ `echo bob` }}"#,
|
||||
echo {{ `echo hello` + "blarg" }} {{ `echo bob` }}"#,
|
||||
r#"a:
|
||||
echo {{`echo hello` + "blarg"}} {{`echo bob`}}"#,
|
||||
echo {{`echo hello` + "blarg"}} {{`echo bob`}}"#,
|
||||
);
|
||||
}
|
||||
|
||||
@ -1091,7 +1091,7 @@ wut:
|
||||
fn readme_test() {
|
||||
let mut justfiles = vec![];
|
||||
let mut current = None;
|
||||
|
||||
|
||||
for line in brev::slurp("README.md").lines() {
|
||||
if let Some(mut justfile) = current {
|
||||
if line == "```" {
|
||||
|
Loading…
Reference in New Issue
Block a user