Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 0a08179

Browse files
committed
return value directly from if/else block
1 parent 4f8ffd0 commit 0a08179

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

crates/ide-assists/src/handlers/extract_module.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ pub(crate) fn extract_module(acc: &mut Assists, ctx: &AssistContext<'_>) -> Opti
118118

119119
let mut body_items: Vec<String> = Vec::new();
120120
let mut items_to_be_processed: Vec<ast::Item> = module.body_items.clone();
121-
let mut new_item_indent = old_item_indent + 1;
122121

123-
if impl_parent.is_some() {
124-
new_item_indent = old_item_indent + 2;
122+
let new_item_indent = if impl_parent.is_some() {
123+
old_item_indent + 2
125124
} else {
126125
items_to_be_processed = [module.use_items.clone(), items_to_be_processed].concat();
127-
}
126+
old_item_indent + 1
127+
};
128128

129129
for item in items_to_be_processed {
130130
let item = item.indent(IndentLevel(1));

crates/parser/src/grammar/paths.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,12 @@ fn path_segment(p: &mut Parser<'_>, mode: Mode, first: bool) {
8383
}
8484
p.expect(T![>]);
8585
} else {
86-
let mut empty = true;
87-
if first {
86+
let empty = if first {
8887
p.eat(T![::]);
89-
empty = false;
90-
}
88+
false
89+
} else {
90+
true
91+
};
9192
match p.current() {
9293
IDENT => {
9394
name_ref(p);

0 commit comments

Comments
 (0)