From 83f40aa805c50bed8533d9227679f9d7684f911d Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sat, 19 Oct 2019 20:00:41 -0700 Subject: [PATCH] Improve messages for alias error messages (#500) --- src/compilation_error.rs | 5 +++-- tests/integration.rs | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/compilation_error.rs b/src/compilation_error.rs index 06b106c..0b3b955 100644 --- a/src/compilation_error.rs +++ b/src/compilation_error.rs @@ -22,9 +22,10 @@ impl<'a> Display for CompilationError<'a> { AliasShadowsRecipe { alias, recipe_line } => { writeln!( f, - "Alias `{}` defined on `{}` shadows recipe defined on `{}`", + "Alias `{}` defined on line {} shadows recipe `{}` defined on line {}", alias, self.line.ordinal(), + alias, recipe_line.ordinal(), )?; } @@ -85,7 +86,7 @@ impl<'a> Display for CompilationError<'a> { DuplicateAlias { alias, first } => { writeln!( f, - "Alias `{}` first defined on line `{}` is redefined on line `{}`", + "Alias `{}` first defined on line {} is redefined on line {}", alias, first.ordinal(), self.line.ordinal(), diff --git a/tests/integration.rs b/tests/integration.rs index bca05e0..5c3aa55 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -237,7 +237,7 @@ integration_test! { name: duplicate_alias, justfile: "alias foo := bar\nalias foo := baz\n", stderr: " - error: Alias `foo` first defined on line `1` is redefined on line `2` + error: Alias `foo` first defined on line 1 is redefined on line 2 | 2 | alias foo := baz | ^^^ @@ -261,7 +261,7 @@ integration_test! { name: alias_shadows_recipe, justfile: "bar:\n echo bar\nalias foo := bar\nfoo:\n echo foo", stderr: " - error: Alias `foo` defined on `3` shadows recipe defined on `4` + error: Alias `foo` defined on line 3 shadows recipe `foo` defined on line 4 | 3 | alias foo := bar | ^^^