aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/picker.rs
diff options
context:
space:
mode:
authorPascal Kuthe2023-02-09 02:24:31 +0000
committerGitHub2023-02-09 02:24:31 +0000
commite474779c8729c36335b76badc98d8211829122d2 (patch)
tree8543a76fca8dfcfe6988e195c6af01b431da3af7 /helix-term/src/ui/picker.rs
parentbd14f5a72cec6932cf1792d62e420349eaec60db (diff)
bump msrv to 1.63 (#5570)
* bump msrv to 1.63 * resolve new complex type clippy lints
Diffstat (limited to 'helix-term/src/ui/picker.rs')
-rw-r--r--helix-term/src/ui/picker.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs
index 5190fc53..803e2d65 100644
--- a/helix-term/src/ui/picker.rs
+++ b/helix-term/src/ui/picker.rs
@@ -70,6 +70,8 @@ impl From<DocumentId> for PathOrId {
}
}
+type FileCallback<T> = Box<dyn Fn(&Editor, &T) -> Option<FileLocation>>;
+
/// File path and range of lines (used to align and highlight lines)
pub type FileLocation = (PathOrId, Option<(usize, usize)>);
@@ -80,7 +82,7 @@ pub struct FilePicker<T: Item> {
preview_cache: HashMap<PathBuf, CachedPreview>,
read_buffer: Vec<u8>,
/// Given an item in the picker, return the file path and line number to display.
- file_fn: Box<dyn Fn(&Editor, &T) -> Option<FileLocation>>,
+ file_fn: FileCallback<T>,
}
pub enum CachedPreview {
@@ -394,6 +396,8 @@ impl Ord for PickerMatch {
}
}
+type PickerCallback<T> = Box<dyn Fn(&mut Context, &T, Action)>;
+
pub struct Picker<T: Item> {
options: Vec<T>,
editor_data: T::Data,
@@ -415,7 +419,7 @@ pub struct Picker<T: Item> {
/// Constraints for tabular formatting
widths: Vec<Constraint>,
- callback_fn: Box<dyn Fn(&mut Context, &T, Action)>,
+ callback_fn: PickerCallback<T>,
}
impl<T: Item> Picker<T> {