Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
continue-on-error: true

- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: rust-clippy-results.sarif
wait-for-processing: true
8 changes: 6 additions & 2 deletions src/structs/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,17 @@ impl Prompt<'_> {
/// Result contains `Some(index)` if user hit 'Enter' or `None` if user cancelled with 'Esc' or 'q'.
#[inline]
pub fn run(&self) -> io::Result<Option<(usize, KeyModifiers)>> {
self._run(&Term::stderr(), true)
self.run_internal(&Term::stderr(), true)
}

/// Like `interact` but allows a specific terminal to be set.
/// Ignore `clippy::too-many-lines`
#[allow(clippy::too_many_lines)] // TODO: refactor
fn _run(&self, term: &Term, allow_quit: bool) -> io::Result<Option<(usize, KeyModifiers)>> {
fn run_internal(
&self,
term: &Term,
allow_quit: bool,
) -> io::Result<Option<(usize, KeyModifiers)>> {
// This cursor iterates over the graphemes vec rather than the search term
let mut cursor_pos = 0;
let mut search_term: Vec<String> = Vec::new();
Expand Down
4 changes: 2 additions & 2 deletions src/structs/prompt_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl Theme {
char = format!("{}", self.active_item_style.apply_to(c));
} else {
char = format!("{c}");
};
}
output.push_str(&char);
}
write!(f, "{}", link_with_label(pretty_path(&entry.path), &output))?;
Expand Down Expand Up @@ -246,7 +246,7 @@ impl<'a> TermRenderer<'a> {
f: F,
) -> io::Result<()> {
let mut buf = String::new();
f(self, &mut buf).map_err(|err| io::Error::new(io::ErrorKind::Other, err))?;
f(self, &mut buf).map_err(io::Error::other)?;
self.height += buf.chars().filter(|&x| x == '\n').count() + 1;
self.term.write_line(&buf)
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub fn resolve_lnk(path: &String) -> String {

if link.is_err() {
err(format!("Failed to read shortcut \"{}\"", pretty_path(path)));
return path.to_string();
return path.clone();
}

let path_to_open = link
Expand All @@ -31,7 +31,7 @@ pub fn resolve_lnk(path: &String) -> String {
.and_then(|link_target| fs::canonicalize(link_target).ok());

path_to_open.map_or_else(
|| path.to_string(),
|| path.clone(),
|path_to_open| path_to_open.to_string_lossy().to_string(),
)
}
Expand Down