mirror of https://github.com/helix-editor/helix
Avoid unnecessary clone when formatting error (#1903)
Instead of first cloning the query and then allocating again to format the error, format the error using a reference to the query.pull/1917/head
parent
8165febe23
commit
85c23b31de
|
@ -1646,11 +1646,8 @@ fn search_next_or_prev_impl(cx: &mut Context, movement: Movement, direction: Dir
|
||||||
wrap_around,
|
wrap_around,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// get around warning `mutable_borrow_reservation_conflict`
|
let error = format!("Invalid regex: {}", query);
|
||||||
// which will be a hard error in the future
|
cx.editor.set_error(error);
|
||||||
// see: https://github.com/rust-lang/rust/issues/59159
|
|
||||||
let query = query.clone();
|
|
||||||
cx.editor.set_error(format!("Invalid regex: {}", query));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue