Repository: casey/just
File: src/parser.rs (Rust)

Code before:
        Keyword::WindowsPowershell => Some(Setting::WindowsPowerShell(self.parse_set_bool()?)),
        _ => None,
      },
      None => None,
    };

    if let Some(value) = set_bool {
      return Ok(Set { name, value });
    }

    self.expect(ColonEquals)?;

    if name.lexeme() == Keyword::Shell.lexeme() {
      Ok(Set {
        value: Setting::Shell(self.parse_shell()?),
        name,
      })
    } else if name.lexeme() == Keyword::WindowsShell.lexeme() {
      Ok(Set {
        value: Setting::WindowsShell(self.parse_shell()?),
        name,
      })
    } else if name.lexeme() == Keyword::Tempdir.lexeme() {
      Ok(Set {
        value: Setting::Tempdir(self.parse_path()?),
        name,
      })
    } else {
      Err(name.error(CompileErrorKind::UnknownSetting {
        setting: name.lexeme(),
      }))
    }
  }

  // Parse tempdir setting value
  fn parse_path(&mut self) -> CompileResult<'src, StringLiteral<'src>> {
    let path = self.parse_string_literal()?;
    Ok(path)
  }

  /// Parse a shell setting value
  fn parse_shell(&mut self) -> CompileResult<'src, Shell<'src>> {
    self.expect(BracketL)?;

    let command = self.parse_string_literal()?;

    let mut arguments = Vec::new();

    if self.accepted(Comma)? {
      while !self.next_is(BracketR) {
        arguments.push(self.parse_string_literal()?);

Review comment (suggestion):
I think this can just be inlined, also the value of `Seting::Tempdir` can be a `String`:

```suggestion
        value: Setting::Tempdir(self.parse_string_literal()?.cooked),
```

Code after:
    let set_bool: Option<Setting> = match Keyword::from_lexeme(lexeme) {
      Some(kw) => match kw {
        Keyword::AllowDuplicateRecipes => {
          Some(Setting::AllowDuplicateRecipes(self.parse_set_bool()?))
        }
        Keyword::DotenvLoad => Some(Setting::DotenvLoad(self.parse_set_bool()?)),
        Keyword::Export => Some(Setting::Export(self.parse_set_bool()?)),
        Keyword::Fallback => Some(Setting::Fallback(self.parse_set_bool()?)),
        Keyword::IgnoreComments => Some(Setting::IgnoreComments(self.parse_set_bool()?)),
        Keyword::PositionalArguments => Some(Setting::PositionalArguments(self.parse_set_bool()?)),
        Keyword::WindowsPowershell => Some(Setting::WindowsPowerShell(self.parse_set_bool()?)),
        _ => None,
      },
      None => None,
    };

    if let Some(value) = set_bool {
      return Ok(Set { name, value });
    }

    self.expect(ColonEquals)?;

    if name.lexeme() == Keyword::Shell.lexeme() {
      Ok(Set {
        value: Setting::Shell(self.parse_shell()?),
        name,
      })
    } else if name.lexeme() == Keyword::WindowsShell.lexeme() {
      Ok(Set {
        value: Setting::WindowsShell(self.parse_shell()?),
        name,
      })
    } else if name.lexeme() == Keyword::Tempdir.lexeme() {
      Ok(Set {
        value: Setting::Tempdir(self.parse_string_literal()?.cooked),
        name,
      })
    } else {
      Err(name.error(CompileErrorKind::UnknownSetting {
        setting: name.lexeme(),
      }))
    }
  }

  /// Parse a shell setting value
  fn parse_shell(&mut self) -> CompileResult<'src, Shell<'src>> {
    self.expect(BracketL)?;

    let command = self.parse_string_literal()?;

    let mut arguments = Vec::new();