<commit_before>set -ex

main() {
  # Done in ci/install.sh
  #install_c_toolchain
  install_standard_crates
  configure_cargo
  test_cargo_project
}

install_standard_crates() {
  multirust add-target nightly $TARGET
}

configure_cargo() {
  local prefix

  case "$TARGET" in
    arm*-unknown-linux-gnueabihf)
      prefix=arm-linux-gnueabihf
      ;;
    arm-unknown-linux-gnueabi)
      prefix=arm-linux-gnueabi
      ;;
    mipsel-unknown-linux-musl)
      prefix=mipsel-openwrt-linux
      ;;
    x86_64-pc-windows-gnu)
      prefix=x86_64-w64-mingw32
      ;;
    *)
      return
      ;;
  esac

  mkdir -p ~/.cargo

  cat >>~/.cargo/config <<EOF
[target.$TARGET]
linker = "$prefix-gcc"
EOF
}

test_cargo_project() {
  cargo new --bin hello

  cd hello
  cargo build --target $TARGET

  if [ "$TARGET" =~ "windows" ]; then
    file target/$TARGET/debug/hello.exe
  else
    file target/$TARGET/debug/hello
  fi
}

main<commit_msg>use double brackets for substring matching<commit_after>set -ex

main() {
  # Done in ci/install.sh
  #install_c_toolchain
  install_standard_crates
  configure_cargo
  test_cargo_project
}

install_standard_crates() {
  multirust add-target nightly $TARGET
}

configure_cargo() {
  local prefix

  case "$TARGET" in
    arm*-unknown-linux-gnueabihf)
      prefix=arm-linux-gnueabihf
      ;;
    arm-unknown-linux-gnueabi)
      prefix=arm-linux-gnueabi
      ;;
    mipsel-unknown-linux-musl)
      prefix=mipsel-openwrt-linux
      ;;
    x86_64-pc-windows-gnu)
      prefix=x86_64-w64-mingw32
      ;;
    *)
      return
      ;;
  esac

  mkdir -p ~/.cargo

  cat >>~/.cargo/config <<EOF
[target.$TARGET]
linker = "$prefix-gcc"
EOF
}

test_cargo_project() {
  cargo new --bin hello

  cd hello
  cargo build --target $TARGET

  if [[ "$TARGET" =~ "windows" ]]; then
    file target/$TARGET/debug/hello.exe
  else
    file target/$TARGET/debug/hello
  fi
}

main
{'fraction_non_alphanumeric': 0.12191276931161324, 'fraction_numerical': 0.012611665790856543, 'mean_word_length': 2.675675675675676, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1913401', 'n_tokens_mistral': 748, 'n_tokens_neox': 705, 'n_words': 130}