Repository: casey/just (rust)

Issue:
Parse error when a comment is on the same line as a setting
This justfile:

```
set dotenv-load # comment
```

Produces this error:

```
error: Expected '*', ':', '$', '=', identifier, or '+', but found comment
   |
17 | set dotenv-load # comment
   |                 ^^^^^^^^^
```

Pull request:
Allow comments on same line as settings
Fixes #1338.

Patch:
diff --git a/src/parser.rs b/src/parser.rs
index 00ec7e7e..e04c1da9 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -333,8 +333,10 @@ impl<'tokens, 'src> Parser<'tokens, 'src> {
           }
           Some(Keyword::Set)
             if self.next_are(&[Identifier, Identifier, ColonEquals])
-              || self.next_are(&[Identifier, Identifier, Eol])
-              || self.next_are(&[Identifier, Identifier, Eof]) =>
+              || self.next_are(&[Identifier, Identifier, Comment, Eof])
+              || self.next_are(&[Identifier, Identifier, Comment, Eol])
+              || self.next_are(&[Identifier, Identifier, Eof])
+              || self.next_are(&[Identifier, Identifier, Eol]) =>
           {
             items.push(Item::Set(self.parse_set()?));
           }


Test patch:
diff --git a/tests/lib.rs b/tests/lib.rs
index b6fa7a4e..9867e3da 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -58,6 +58,7 @@ mod json;
 mod line_prefixes;
 mod misc;
 mod multibyte_char;
+mod parser;
 mod positional_arguments;
 mod quiet;
 mod quote;
diff --git a/tests/parser.rs b/tests/parser.rs
new file mode 100644
index 00000000..307f1aea
--- /dev/null
+++ b/tests/parser.rs
@@ -0,0 +1,13 @@
+use super::*;
+
+#[test]
+fn dont_run_duplicate_recipes() {
+  Test::new()
+    .justfile(
+      "
+      set dotenv-load # foo
+      bar:
+      ",
+    )
+    .run();
+}