Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
sudormrfbin committed Feb 3, 2023
1 parent ef0528a commit 792c8f9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions helix-term/src/ui/picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ impl From<DocumentId> for PathOrId {
/// File path and range of lines (used to align and highlight lines)
pub type FileLocation = (PathOrId, Option<(usize, usize)>);

type FilePreviewFn<T> = Box<dyn Fn(&Editor, &T) -> Option<FileLocation>>;

pub enum CachedPreview {
Document(Box<Document>),
Binary,
Expand Down Expand Up @@ -136,15 +138,15 @@ pub struct Picker<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: Option<Box<dyn Fn(&Editor, &T) -> Option<FileLocation>>>,
file_fn: Option<FilePreviewFn<T>>,
}

impl<T: Item + 'static> Picker<T> {
fn new(
options: Vec<T>,
editor_data: T::Data,
callback_fn: Box<dyn Fn(&mut Context, &T, Action) + 'static>,
preview_fn: Option<Box<dyn Fn(&Editor, &T) -> Option<FileLocation> + 'static>>,
preview_fn: Option<FilePreviewFn<T>>,
) -> Self {
let prompt = Prompt::new(
"".into(),
Expand Down Expand Up @@ -281,7 +283,6 @@ impl<T: Item + 'static> Picker<T> {
let pattern = self.prompt.line();
self.previous_pattern.0.clone_from(pattern);
self.previous_pattern.1 = query;

}

pub fn force_score(&mut self) {
Expand Down

0 comments on commit 792c8f9

Please sign in to comment.