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

Code before:
  pub(crate) positional_arguments: bool,
  pub(crate) shell: Option<setting::Shell<'src>>,
  pub(crate) windows_powershell: bool,
}

impl<'src> Settings<'src> {
  pub(crate) fn new() -> Settings<'src> {
    Settings {
      dotenv_load: None,
      export: false,
      positional_arguments: false,
      shell: None,
      windows_powershell: false,
    }
  }

  pub(crate) fn shell_command(&self, config: &Config) -> Command {
    let mut cmd = Command::new(self.shell_binary(config));

    cmd.args(self.shell_arguments(config));

    cmd
  }

  pub(crate) fn shell_binary<'a>(&'a self, config: &'a Config) -> &'a str {
    let shell_or_args_present = config.shell.is_some() | config.shell_args.is_some();

    if let (Some(shell), false) = (&self.shell, shell_or_args_present) {
      shell.command.cooked.as_ref()
    } else if let Some(shell) = &config.shell {
      shell
    } else if cfg!(windows) && self.windows_powershell {
      WINDOWS_DEFAULT_SHELL
    } else {
      DEFAULT_SHELL
    }
  }

  pub(crate) fn shell_arguments<'a>(&'a self, config: &'a Config) -> Vec<&'a str> {
    let shell_or_args_present = config.shell.is_some() | config.shell_args.is_some();

    if let (Some(shell), false) = (&self.shell, shell_or_args_present) {
      shell
        .arguments
        .iter()
        .map(|argument| argument.cooked.as_ref())
        .collect()
    } else if let Some(shell_args) = &config.shell_args {
      shell_args.iter().map(String::as_ref).collect()
    } else if cfg!(windows) && self.windows_powershell {
      WINDOWS_DEFAULT_SHELL_ARGS.to_vec()

Review comment (suggestion):
It's better to use `||` instead of `|`. They both work, but for clarity, `|` should only be used when you want bitwise or.

```suggestion
    let shell_or_args_present = config.shell.is_some() || config.shell_args.is_some();
```

Code after:
  pub(crate) positional_arguments: bool,
  pub(crate) shell: Option<setting::Shell<'src>>,
  pub(crate) windows_powershell: bool,
}

impl<'src> Settings<'src> {
  pub(crate) fn new() -> Settings<'src> {
    Settings {
      dotenv_load: None,
      export: false,
      positional_arguments: false,
      shell: None,
      windows_powershell: false,
    }
  }

  pub(crate) fn shell_command(&self, config: &Config) -> Command {
    let mut cmd = Command::new(self.shell_binary(config));

    cmd.args(self.shell_arguments(config));

    cmd
  }

  pub(crate) fn shell_binary<'a>(&'a self, config: &'a Config) -> &'a str {
    let shell_or_args_present = config.shell.is_some() || config.shell_args.is_some();

    if let (Some(shell), false) = (&self.shell, shell_or_args_present) {
      shell.command.cooked.as_ref()
    } else if let Some(shell) = &config.shell {
      shell
    } else if cfg!(windows) && self.windows_powershell {
      WINDOWS_POWERSHELL_SHELL
    } else {
      DEFAULT_SHELL
    }
  }

  pub(crate) fn shell_arguments<'a>(&'a self, config: &'a Config) -> Vec<&'a str> {
    let shell_or_args_present = config.shell.is_some() || config.shell_args.is_some();

    if let (Some(shell), false) = (&self.shell, shell_or_args_present) {
      shell
        .arguments
        .iter()
        .map(|argument| argument.cooked.as_ref())
        .collect()
    } else if let Some(shell_args) = &config.shell_args {
      shell_args.iter().map(String::as_ref).collect()
    } else if cfg!(windows) && self.windows_powershell {
      WINDOWS_POWERSHELL_ARGS.to_vec()