mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Auto merge of #16722 - mo8it:allocations, r=Veykril
Avoid some allocations I went on a small `.clone()` hunting tour :D
This commit is contained in:
commit
2074cc28de
6 changed files with 30 additions and 27 deletions
|
@ -37,7 +37,7 @@ impl<I> Incoming<I> {
|
|||
}
|
||||
|
||||
pub fn cancel(&mut self, id: RequestId) -> Option<Response> {
|
||||
let _data = self.complete(id.clone())?;
|
||||
let _data = self.complete(&id)?;
|
||||
let error = ResponseError {
|
||||
code: ErrorCode::RequestCanceled as i32,
|
||||
message: "canceled by client".to_owned(),
|
||||
|
@ -46,8 +46,8 @@ impl<I> Incoming<I> {
|
|||
Some(Response { id, result: None, error: Some(error) })
|
||||
}
|
||||
|
||||
pub fn complete(&mut self, id: RequestId) -> Option<I> {
|
||||
self.pending.remove(&id)
|
||||
pub fn complete(&mut self, id: &RequestId) -> Option<I> {
|
||||
self.pending.remove(id)
|
||||
}
|
||||
|
||||
pub fn is_completed(&self, id: &RequestId) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue