diff --git a/crates/ide/src/matching_brace.rs b/crates/ide/src/matching_brace.rs index 261dcc2559..011c8cc553 100644 --- a/crates/ide/src/matching_brace.rs +++ b/crates/ide/src/matching_brace.rs @@ -19,14 +19,10 @@ use syntax::{ pub(crate) fn matching_brace(file: &SourceFile, offset: TextSize) -> Option { const BRACES: &[SyntaxKind] = &[T!['{'], T!['}'], T!['['], T![']'], T!['('], T![')'], T![<], T![>], T![|], T![|]]; - let (brace_token, brace_idx) = file - .syntax() - .token_at_offset(offset) - .filter_map(|node| { - let idx = BRACES.iter().position(|&brace| brace == node.kind())?; - Some((node, idx)) - }) - .next()?; + let (brace_token, brace_idx) = file.syntax().token_at_offset(offset).find_map(|node| { + let idx = BRACES.iter().position(|&brace| brace == node.kind())?; + Some((node, idx)) + })?; let parent = brace_token.parent()?; if brace_token.kind() == T![|] && !ast::ParamList::can_cast(parent.kind()) { cov_mark::hit!(pipes_not_braces); diff --git a/crates/ide/src/parent_module.rs b/crates/ide/src/parent_module.rs index 99365c8a73..9b1f480446 100644 --- a/crates/ide/src/parent_module.rs +++ b/crates/ide/src/parent_module.rs @@ -1,6 +1,8 @@ use hir::Semantics; -use ide_db::base_db::{CrateId, FileId, FilePosition}; -use ide_db::RootDatabase; +use ide_db::{ + base_db::{CrateId, FileId, FilePosition}, + RootDatabase, +}; use itertools::Itertools; use syntax::{ algo::find_node_at_offset,