Skip to content

Commit a9d5c8f

Browse files
committed
clippy
1 parent ad78ab0 commit a9d5c8f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/cst.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ impl CstRootNode {
466466
/// Computes the single indentation text of the file.
467467
pub fn single_indent_text(&self) -> Option<String> {
468468
let root_value = self.root_value()?;
469-
let first_non_trivia_child = root_value.children_exclude_trivia().get(0)?.clone();
469+
let first_non_trivia_child = root_value.children_exclude_trivia().first()?.clone();
470470
let mut looking_node = first_non_trivia_child;
471471
while let Some(previous_trivia) = looking_node.previous_sibling() {
472472
if let CstNode::Leaf(CstLeafNode::Whitespace(whitespace)) = &previous_trivia {
@@ -618,10 +618,10 @@ impl CstObjectProp {
618618
let name = self.name()?;
619619
let parent_info = name.parent_info().unwrap(); // todo(THIS PR): do not unwrap
620620
let children = &self.0.borrow().value;
621-
let mut children = (&children[parent_info.child_index + 1..]).iter();
621+
let mut children = children[parent_info.child_index + 1..].iter();
622622

623623
// first, skip over the colon token
624-
while let Some(child) = children.next() {
624+
for child in children.by_ref() {
625625
if let CstNode::Leaf(CstLeafNode::Token(token)) = child {
626626
if token.value() == ':' {
627627
break;
@@ -630,7 +630,7 @@ impl CstObjectProp {
630630
}
631631

632632
// now find the value
633-
while let Some(child) = children.next() {
633+
for child in children {
634634
match child {
635635
CstNode::Leaf(leaf) => match leaf {
636636
CstLeafNode::BooleanLit(_)

0 commit comments

Comments
 (0)