Skip to content

Commit 5c3a93c

Browse files
committed
Remove incorrect assertion in extract_function
1 parent 55d4813 commit 5c3a93c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

crates/ide_assists/src/handlers/extract_function.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -601,10 +601,7 @@ impl FunctionBody {
601601
if local_ref.is_self(sema.db) {
602602
match local_ref.source(sema.db).value {
603603
Either::Right(it) => {
604-
stdx::always!(
605-
self_param.replace(it).is_none(),
606-
"body references two different self params"
607-
);
604+
self_param.replace(it);
608605
}
609606
Either::Left(_) => {
610607
stdx::never!(
@@ -2369,7 +2366,7 @@ struct S { f: i32 };
23692366
23702367
impl S {
23712368
fn foo(&self) -> i32 {
2372-
$01+self.f$0
2369+
$0self.f+self.f$0
23732370
}
23742371
}
23752372
"#,
@@ -2382,7 +2379,7 @@ impl S {
23822379
}
23832380
23842381
fn $0fun_name(&self) -> i32 {
2385-
1+self.f
2382+
self.f+self.f
23862383
}
23872384
}
23882385
"#,

0 commit comments

Comments
 (0)