Skip to content

Commit

Permalink
Remove need for lifetime on FzfOpts (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
denisidoro authored Mar 19, 2020
1 parent 73cd346 commit 64045e3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/flows/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn gen_core_fzf_opts(variant: Variant, config: &Config) -> FzfOpts {
Some(format!("{} preview {{}}", filesystem::exe_string()))
},
autoselect: !config.no_autoselect,
overrides: config.fzf_overrides.as_ref(),
overrides: config.fzf_overrides.clone(),
suggestion_type: SuggestionType::SnippetSelection,
..Default::default()
};
Expand Down Expand Up @@ -87,7 +87,7 @@ fn prompt_with_suggestions(

let mut opts = FzfOpts {
autoselect: !config.no_autoselect,
overrides: config.fzf_overrides_var.as_ref(),
overrides: config.fzf_overrides_var.clone(),
prompt: Some(display::variable_prompt(varname)),
..Default::default()
};
Expand All @@ -96,7 +96,7 @@ fn prompt_with_suggestions(
opts.suggestion_type = o.suggestion_type;
opts.header_lines = o.header_lines;
opts.column = o.column;
opts.delimiter = o.delimiter.as_deref();
opts.delimiter = o.delimiter.clone();
};

let (output, _) = fzf::call(opts, |stdin| {
Expand Down
2 changes: 1 addition & 1 deletion src/flows/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub fn add(uri: String) -> Result<(), Box<dyn Error>> {
header: Some(
"Select the cheatsheets you want to import with <TAB> then hit <Enter>".to_string(),
),
overrides: Some(&overrides),
overrides: Some(overrides),
..Default::default()
};

Expand Down
2 changes: 1 addition & 1 deletion src/fzf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ where
get_column(
parse_output_single(text, opts.suggestion_type),
opts.column,
opts.delimiter,
opts.delimiter.as_deref(),
),
result,
)
Expand Down
8 changes: 4 additions & 4 deletions src/structures/fzf.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
use crate::structures::cheat::SuggestionType;

pub struct Opts<'a> {
pub struct Opts {
pub query: Option<String>,
pub filter: Option<String>,
pub prompt: Option<String>,
pub preview: Option<String>,
pub autoselect: bool,
pub overrides: Option<&'a String>, // TODO: remove &'a
pub overrides: Option<String>,
pub header_lines: u8,
pub header: Option<String>,
pub suggestion_type: SuggestionType,
pub delimiter: Option<&'a str>,
pub delimiter: Option<String>,
pub column: Option<u8>,
}

impl Default for Opts<'_> {
impl Default for Opts {
fn default() -> Self {
Self {
query: None,
Expand Down

0 comments on commit 64045e3

Please sign in to comment.