Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ use crate::Violation;
use crate::checkers::ast::Checker;

/// ## What it does
/// Checks for `for` loops that can be replaced by a making a copy of a list.
/// Checks for `for` loops that append every item of an iterable to a list,
/// which can be replaced with a call to `list`.
///
/// ## Why is this bad?
/// When creating a copy of an existing list using a for-loop, prefer
/// `list` or `list.copy` instead. Making a direct copy is more readable and
/// more performant.
/// When populating a list from an iterable with a `for` loop, prefer `list`
/// instead. The `list` call is more readable and more performant. For an
/// existing list, you can also use `list.copy` instead of `list`.
///
/// Using the below as an example, the `list`-based copy is ~2x faster on
/// Python 3.11.
Expand Down
Loading