RS.CLIPPY.REDUNDANT_TEST_PREFIX

Redundant `test_` prefix in test function name

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: redundant_test_prefix. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for test functions (functions annotated with #[test]) that are prefixed with test_ which is redundant.

Why is this bad?

This is redundant because test functions are already annotated with #[test]. Moreover, it clutters the output of cargo test since test functions are expanded as module::tests::test_use_case in the output. Without the redundant prefix, the output becomes module::tests::use_case, which is more readable.

Example

#[cfg(test)]
mod tests {
  use super::*;

  #[test]
  fn test_use_case() {
      // test code
  }
}

Use instead:

#[cfg(test)]
mod tests {
  use super::*;

  #[test]
  fn use_case() {
      // test code
  }
}