[alias]
# Do not append `--` or it will break IDEs
ck = "check --workspace --all-targets --all-features --locked"
lint = "clippy --workspace --all-targets --all-features"
codecov = "llvm-cov nextest --profile codecov --workspace --ignore-filename-regex tasks"
coverage = "run -p oxc_coverage --release --"
benchmark = "run -p oxc_benchmark --release --"
minsize = "run -p oxc_minsize --release --"
rule = "run -p rulegen"

[build]
rustflags = ["-C", "target-cpu=native"]

[target.'cfg(all())']
rustflags = [
  # CLIPPY LINT SETTINGS
  # This is a workaround to configure lints for the entire workspace, pending the ability to configure this via TOML.
  # Wait for [RFC3389](https://github.com/rust-lang/rfcs/pull/3389) and [Tracking Issue](https://github.com/rust-lang/cargo/issues/12115)
  "-Wclippy::all",

  # I want to write the best Rust code so both pedantic and nursery is enabled.
  # We should only disable rules globally if they are either false positives, chaotic, or does not make sense.
  "-Wclippy::pedantic",
  "-Wclippy::nursery",

  # restriction

  "-Wclippy::dbg_macro",
  "-Wclippy::todo",
  "-Wclippy::unimplemented",

  # I like the explicitness of this rule as it removes confusion around `clone`.
  # This increases readability, avoids `clone` mindlessly and heap allocating on accident.
  "-Wclippy::clone_on_ref_ptr",

  # These two are mutually exclusive, I like `mod.rs` files for better fuzzy searches on module entries.
  "-Wclippy::self_named_module_files", # "-Wclippy::mod_module_files",

  "-Wclippy::empty_drop",
  "-Wclippy::empty_structs_with_brackets",
  "-Wclippy::exit",
  "-Wclippy::filetype_is_file",
  "-Wclippy::get_unwrap",
  "-Wclippy::impl_trait_in_params",
  "-Wclippy::rc_buffer",
  "-Wclippy::rc_mutex",
  "-Wclippy::rest_pat_in_fully_bound_structs",
  # "-Wclippy::same_name_method", # broke bitflags v2
  "-Wclippy::unnecessary_safety_comment",
  # TODO "-Wclippy::undocumented_unsafe_blocks",

  # pedantic

  # This rule is too pedantic, I don't want to force this because naming things are hard.
  "-Aclippy::module_name_repetitions",

  # #[must_use] is creating too much noise for this codebase, it does not add much value execept nagging
  # the programmer to add a #[must_use] after clippy has been run.
  # Having #[must_use] every where also hinders readability.
  "-Aclippy::must_use_candidate",

  # Generated from the `index_vec` crate.
  # this error originates in the macro `$crate::__define_index_type_inner` which comes from the expansion of the macro `define_index_type`
  "-Aclippy::used_underscore_binding",
  "-Aclippy::doc_markdown",

  # nursery

  # `const` functions do not make sense for our project because this is not a `const` library.
  # This rule also confuses new comers and forces them to add `const` blindlessly without any reason.
  "-Aclippy::missing_const_for_fn",

  # style

  # Having both `new` and `default` for a struct is confusing, just implement the more appropriate one.
  "-Aclippy::new_without_default",
]
