mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Flip Assist::new arguments
This commit is contained in:
parent
8803e748a6
commit
13c078db9c
2 changed files with 4 additions and 4 deletions
|
@ -100,7 +100,7 @@ impl<'a> AssistCtx<'a> {
|
|||
label: impl Into<String>,
|
||||
f: impl FnOnce(&mut ActionBuilder),
|
||||
) -> Option<Assist> {
|
||||
let label = AssistLabel::new(label.into(), id);
|
||||
let label = AssistLabel::new(id, label.into());
|
||||
|
||||
let mut info = AssistInfo::new(label);
|
||||
if self.should_compute_edit {
|
||||
|
@ -157,7 +157,7 @@ impl<'a> AssistGroup<'a> {
|
|||
label: impl Into<String>,
|
||||
f: impl FnOnce(&mut ActionBuilder),
|
||||
) {
|
||||
let label = AssistLabel::new(label.into(), id);
|
||||
let label = AssistLabel::new(id, label.into());
|
||||
|
||||
let mut info = AssistInfo::new(label).with_group(GroupLabel(self.group_name.clone()));
|
||||
if self.ctx.should_compute_edit {
|
||||
|
|
|
@ -32,16 +32,16 @@ pub struct AssistId(pub &'static str);
|
|||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct AssistLabel {
|
||||
pub id: AssistId,
|
||||
/// Short description of the assist, as shown in the UI.
|
||||
pub label: String,
|
||||
pub id: AssistId,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct GroupLabel(pub String);
|
||||
|
||||
impl AssistLabel {
|
||||
pub(crate) fn new(label: String, id: AssistId) -> AssistLabel {
|
||||
pub(crate) fn new(id: AssistId, label: String) -> AssistLabel {
|
||||
// FIXME: make fields private, so that this invariant can't be broken
|
||||
assert!(label.starts_with(|c: char| c.is_uppercase()));
|
||||
AssistLabel { label, id }
|
||||
|
|
Loading…
Reference in a new issue