Remove incorrect assertion in extract_function

This commit is contained in:
Lukas Wirth 2021-08-27 19:58:50 +02:00
parent 55d4813561
commit 5c3a93ca9e

View file

@ -601,10 +601,7 @@ impl FunctionBody {
if local_ref.is_self(sema.db) { if local_ref.is_self(sema.db) {
match local_ref.source(sema.db).value { match local_ref.source(sema.db).value {
Either::Right(it) => { Either::Right(it) => {
stdx::always!( self_param.replace(it);
self_param.replace(it).is_none(),
"body references two different self params"
);
} }
Either::Left(_) => { Either::Left(_) => {
stdx::never!( stdx::never!(
@ -2369,7 +2366,7 @@ struct S { f: i32 };
impl S { impl S {
fn foo(&self) -> i32 { fn foo(&self) -> i32 {
$01+self.f$0 $0self.f+self.f$0
} }
} }
"#, "#,
@ -2382,7 +2379,7 @@ impl S {
} }
fn $0fun_name(&self) -> i32 { fn $0fun_name(&self) -> i32 {
1+self.f self.f+self.f
} }
} }
"#, "#,