1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-07-30 12:07:46 +00:00

refactor: avoid unnecesary clone

This commit is contained in:
Kevin Amado 2022-02-28 23:14:58 -05:00
parent 3184be7cbe
commit 6acd441a1f

View file

@ -43,8 +43,7 @@ pub(crate) fn rule(
})
.collect();
let lines: Vec<String> =
content.split('\n').map(|line| line.to_string()).collect();
let lines: Vec<&str> = content.split('\n').collect();
let should_trim_end: bool =
!lines.is_empty() && lines[lines.len() - 1].trim().is_empty();