Remove trailing whitespace (#167)

This commit is contained in:
Casey Rodarmor 2017-04-02 20:39:23 -07:00 committed by GitHub
parent e45164da4d
commit 435b4c5ea3
3 changed files with 22 additions and 22 deletions

View File

@ -252,7 +252,7 @@ c: b
#[test] #[test]
fn summary() { fn summary() {
let text = let text =
"b: a "b: a
a: a:
d: c d: c
@ -268,7 +268,7 @@ c: b";
#[test] #[test]
fn select() { fn select() {
let text = let text =
"b: "b:
@echo b @echo b
a: a:
@ -288,7 +288,7 @@ c:
#[test] #[test]
fn print() { fn print() {
let text = let text =
"b: "b:
echo b echo b
a: a:
@ -309,7 +309,7 @@ c:
#[test] #[test]
fn show() { fn show() {
let text = let text =
r#"hello = "foo" r#"hello = "foo"
bar = hello + hello bar = hello + hello
recipe: recipe:
@ -327,7 +327,7 @@ recipe:
#[test] #[test]
fn status_passthrough() { fn status_passthrough() {
let text = let text =
" "
hello: hello:

View File

@ -494,7 +494,7 @@ impl<'a> Display for Recipe<'a> {
} }
match *piece { match *piece {
Fragment::Text{ref text} => write!(f, "{}", text.lexeme)?, Fragment::Text{ref text} => write!(f, "{}", text.lexeme)?,
Fragment::Expression{ref expression, ..} => Fragment::Expression{ref expression, ..} =>
write!(f, "{}{}{}", "{{", expression, "}}")?, write!(f, "{}{}{}", "{{", expression, "}}")?,
} }
} }
@ -517,7 +517,7 @@ fn resolve_recipes<'a>(
resolved: empty(), resolved: empty(),
recipes: recipes, recipes: recipes,
}; };
for recipe in recipes.values() { for recipe in recipes.values() {
resolver.resolve(recipe)?; resolver.resolve(recipe)?;
resolver.seen = empty(); resolver.seen = empty();
@ -529,7 +529,7 @@ fn resolve_recipes<'a>(
if let Fragment::Expression{ref expression, ..} = *fragment { if let Fragment::Expression{ref expression, ..} = *fragment {
for variable in expression.variables() { for variable in expression.variables() {
let name = variable.lexeme; let name = variable.lexeme;
let undefined = !assignments.contains_key(name) let undefined = !assignments.contains_key(name)
&& !recipe.parameters.iter().any(|p| p.name == name); && !recipe.parameters.iter().any(|p| p.name == name);
if undefined { if undefined {
// There's a borrow issue here that seems too difficult to solve. // 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); self.evaluated.insert(name, value);
} }
} else { } else {
return Err(RunError::InternalError { return Err(RunError::InternalError {
message: format!("attempted to evaluated unknown assignment {}", name) message: format!("attempted to evaluated unknown assignment {}", name)
}); });
} }
@ -763,7 +763,7 @@ impl<'a, 'b> Evaluator<'a, 'b> {
} else if arguments.contains_key(name) { } else if arguments.contains_key(name) {
arguments[name].to_string() arguments[name].to_string()
} else { } else {
return Err(RunError::InternalError { return Err(RunError::InternalError {
message: format!("attempted to evaluate undefined variable `{}`", name) message: format!("attempted to evaluate undefined variable `{}`", name)
}); });
} }
@ -1048,7 +1048,7 @@ impl<'a> Display for CompileError<'a> {
let bold = maybe_bold(f.alternate()); let bold = maybe_bold(f.alternate());
write!(f, "{} {}", red.paint("error:"), bold.prefix())?; write!(f, "{} {}", red.paint("error:"), bold.prefix())?;
match self.kind { match self.kind {
CircularRecipeDependency{recipe, ref circle} => { CircularRecipeDependency{recipe, ref circle} => {
if circle.len() == 2 { if circle.len() == 2 {
@ -1639,8 +1639,8 @@ fn tokenize(text: &str) -> Result<Vec<Token>, CompileError> {
}); });
} }
let (prefix, lexeme, kind) = let (prefix, lexeme, kind) =
if let (0, &State::Indent(indent), Some(captures)) = if let (0, &State::Indent(indent), Some(captures)) =
(column, state.last().unwrap(), LINE.captures(rest)) { (column, state.last().unwrap(), LINE.captures(rest)) {
let line = captures.at(0).unwrap(); let line = captures.at(0).unwrap();
if !line.starts_with(indent) { 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) (captures.at(1).unwrap(), captures.at(2).unwrap(), Name)
} else if let Some(captures) = EOL.captures(rest) { } else if let Some(captures) = EOL.captures(rest) {
if state.last().unwrap() == &State::Interpolation { if state.last().unwrap() == &State::Interpolation {
return error!(ErrorKind::InternalError { return error!(ErrorKind::InternalError {
message: "hit EOL while still in interpolation state".to_string() 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 len = 0;
let mut escape = false; let mut escape = false;
for c in contents.chars() { for c in contents.chars() {
if c == '\n' || c == '\r' { if c == '\n' || c == '\r' {
return error!(ErrorKind::UnterminatedString); return error!(ErrorKind::UnterminatedString);
} else if !escape && c == '"' { } else if !escape && c == '"' {
@ -1901,7 +1901,7 @@ impl<'a> Parser<'a> {
recipe: name.lexeme, parameter: parameter.lexeme recipe: name.lexeme, parameter: parameter.lexeme
})); }));
} }
let default; let default;
if self.accepted(Equals) { if self.accepted(Equals) {
if let Some(string) = self.accept_any(&[StringToken, RawString]) { if let Some(string) = self.accept_any(&[StringToken, RawString]) {
@ -1981,7 +1981,7 @@ impl<'a> Parser<'a> {
if token.lexeme.starts_with("#!") { if token.lexeme.starts_with("#!") {
shebang = true; shebang = true;
} }
} else if !shebang } else if !shebang
&& !lines.last().and_then(|line| line.last()) && !lines.last().and_then(|line| line.last())
.map(Fragment::continuation).unwrap_or(false) .map(Fragment::continuation).unwrap_or(false)
&& (token.lexeme.starts_with(' ') || token.lexeme.starts_with('\t')) { && (token.lexeme.starts_with(' ') || token.lexeme.starts_with('\t')) {

View File

@ -378,7 +378,7 @@ fn parse_assignments() {
r#"a = "0" r#"a = "0"
c = a + b + a + b c = a + b + a + b
b = "1" b = "1"
"#, "#,
r#"a = "0" r#"a = "0"
@ -392,7 +392,7 @@ fn parse_assignment_backticks() {
parse_summary( parse_summary(
"a = `echo hello` "a = `echo hello`
c = a + b + a + b c = a + b + a + b
b = `echo goodbye`", b = `echo goodbye`",
"a = `echo hello` "a = `echo hello`
@ -405,9 +405,9 @@ c = a + b + a + b");
fn parse_interpolation_backticks() { fn parse_interpolation_backticks() {
parse_summary( parse_summary(
r#"a: r#"a:
echo {{ `echo hello` + "blarg" }} {{ `echo bob` }}"#, echo {{ `echo hello` + "blarg" }} {{ `echo bob` }}"#,
r#"a: r#"a:
echo {{`echo hello` + "blarg"}} {{`echo bob`}}"#, echo {{`echo hello` + "blarg"}} {{`echo bob`}}"#,
); );
} }
@ -1091,7 +1091,7 @@ wut:
fn readme_test() { fn readme_test() {
let mut justfiles = vec![]; let mut justfiles = vec![];
let mut current = None; let mut current = None;
for line in brev::slurp("README.md").lines() { for line in brev::slurp("README.md").lines() {
if let Some(mut justfile) = current { if let Some(mut justfile) = current {
if line == "```" { if line == "```" {