Skip to content

Test function name starts with test_ #8931

Closed
@laralove143

Description

@laralove143

What it does

None of the examples in Rust guidelines on writing tests start functions with test_, which makes for better code quality since tests::foo is more readable than tests::test_foo

Somewhat related to: clippy::module_name_repetitions

Lint Name

test_name_repetitions

Category

pedantic

Advantage

Make the code match Rust guidelines thus making it more idiomatic

Drawbacks

Not sure

Example

#[cfg(test)]
mod tests {
    #[test]
    fn test_foo() {
        assert!(true);
    }
}

Could be written as:

rust
#[cfg(test)]
mod tests {
    #[test]
    fn foo() {
        assert!(true);
    }
}

Metadata

Metadata

Assignees

Labels

A-lintArea: New lints

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions