Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
maksym-arutyunyan committed Sep 2, 2024
1 parent ce8d6e7 commit 7186292
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/strategies/rust_derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,10 @@ fn sort(block: Vec<String>, is_ignore_block_prev_line: bool, strategy: Strategy)
let line_without_comment = line.trim().split("//").next().unwrap_or("").trim();

// Check if the line contains a #[derive(...)] statement
if let Some(derive_range) = line_without_comment
.find("#[derive(")
.map(|start| {
let end = line_without_comment[start..].find(")]")?;
Some(start + 9..start + end)
})
.flatten()
{
if let Some(derive_range) = line_without_comment.find("#[derive(").and_then(|start| {
let end = line_without_comment[start..].find(")]")?;
Some(start + 9..start + end)
}) {
let derive_content = &line_without_comment[derive_range.clone()];
let mut traits: Vec<&str> = derive_content
.split(',')
Expand Down

0 comments on commit 7186292

Please sign in to comment.