Use Default for making Suggestions in attribute_completions (#15764)

# Description

In preparation for https://github.com/nushell/reedline/pull/798, which
adds a new field to `Suggestion`, this PR makes sure that `Suggestion`s
are created using `..Default::default()` inside
`attribute_completions.rs`.

# User-Facing Changes

None

# Tests + Formatting

None

# After Submitting
This commit is contained in:
Yash Thakur 2025-05-16 02:21:40 -04:00 committed by GitHub
parent bb37306d07
commit 7b88bda9a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -33,13 +33,12 @@ impl Completer for AttributeCompletion {
suggestion: Suggestion {
value: String::from_utf8_lossy(name).into_owned(),
description: desc,
style: None,
extra: None,
span: reedline::Span {
start: span.start - offset,
end: span.end - offset,
},
append_whitespace: false,
..Default::default()
},
kind: Some(SuggestionKind::Command(ty, Some(decl_id))),
});
@ -70,13 +69,12 @@ impl Completer for AttributableCompletion {
suggestion: Suggestion {
value: cmd.name().into(),
description: Some(cmd.description().into()),
style: None,
extra: None,
span: reedline::Span {
start: span.start - offset,
end: span.end - offset,
},
append_whitespace: false,
..Default::default()
},
kind: Some(SuggestionKind::Command(cmd.command_type(), None)),
});