10057: fix: Remove incorrect assertion in extract_function r=Veykril a=Veykril

This assertion is actually just wrong
Fixes #10056
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
bors[bot] 2021-08-27 18:00:37 +00:00 committed by GitHub
commit 3acbf94d29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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