Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Feb 6, 2024
1 parent c15fdc0 commit 8810dd3
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion yazi-adaptor/src/kitty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ impl Kitty {

async fn encode(img: DynamicImage) -> Result<Vec<u8>> {
fn output(raw: &[u8], format: u8, size: (u32, u32)) -> Result<Vec<u8>> {
let b64 = general_purpose::STANDARD.encode(raw).chars().collect::<Vec<_>>();
let b64: Vec<_> = general_purpose::STANDARD.encode(raw).chars().collect();

let mut it = b64.chunks(4096).peekable();
let mut buf = Vec::with_capacity(b64.len() + it.len() * 50);
Expand Down
2 changes: 1 addition & 1 deletion yazi-adaptor/src/kitty_old.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl KittyOld {

async fn encode(img: DynamicImage) -> Result<Vec<u8>> {
fn output(raw: &[u8], format: u8, size: (u32, u32)) -> Result<Vec<u8>> {
let b64 = general_purpose::STANDARD.encode(raw).chars().collect::<Vec<_>>();
let b64: Vec<_> = general_purpose::STANDARD.encode(raw).chars().collect();

let mut it = b64.chunks(4096).peekable();
let mut buf = Vec::with_capacity(b64.len() + it.len() * 50);
Expand Down
2 changes: 1 addition & 1 deletion yazi-config/src/theme/filetype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl Filetype {
}
.into(),
})
.collect::<Vec<_>>(),
.collect(),
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion yazi-config/src/theme/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Icon {
text: r.text,
style: StyleShadow { fg: r.fg, ..Default::default() }.into(),
})
.collect::<Vec<_>>(),
.collect(),
)
}
}
4 changes: 2 additions & 2 deletions yazi-core/src/input/snap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ impl InputSnap {
#[inline]
pub(super) fn find_window(s: &str, offset: usize, limit: usize) -> Range<usize> {
let mut width = 0;
let v = s
let v: Vec<_> = s
.chars()
.enumerate()
.skip(offset)
.map_while(|(i, c)| {
width += c.width().unwrap_or(0);
if width < limit { Some(i) } else { None }
})
.collect::<Vec<_>>();
.collect();

if v.is_empty() {
return 0..0;
Expand Down
2 changes: 1 addition & 1 deletion yazi-fm/src/app/commands/update_progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl App {
let tasks = &mut self.cx.tasks;
tasks.progress = opt.progress;

// If the tasks pane is visible, update the summaries with a complete render.
// If the task manager is visible, update the summaries with a complete render.
if tasks.visible {
let new = tasks.paginate();
if new.len() != tasks.summaries.len()
Expand Down
4 changes: 2 additions & 2 deletions yazi-fm/src/completion/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl<'a> Completion<'a> {

impl<'a> Widget for Completion<'a> {
fn render(self, rect: Rect, buf: &mut Buffer) {
let items = self
let items: Vec<_> = self
.cx
.completion
.window()
Expand All @@ -37,7 +37,7 @@ impl<'a> Widget for Completion<'a> {

item
})
.collect::<Vec<_>>();
.collect();

let input_area = self.cx.area(&self.cx.input.position);
let mut area = Position::sticky(input_area, Offset {
Expand Down
14 changes: 7 additions & 7 deletions yazi-fm/src/help/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ impl Widget for Bindings<'_> {
}

// On
let col1 =
bindings.iter().map(|c| ListItem::new(c.on()).style(THEME.help.on)).collect::<Vec<_>>();
let col1: Vec<_> =
bindings.iter().map(|c| ListItem::new(c.on()).style(THEME.help.on.into())).collect();

// Exec
let col2 =
bindings.iter().map(|c| ListItem::new(c.exec()).style(THEME.help.exec)).collect::<Vec<_>>();
let col2: Vec<_> =
bindings.iter().map(|c| ListItem::new(c.exec()).style(THEME.help.exec.into())).collect();

// Desc
let col3 = bindings
let col3: Vec<_> = bindings
.iter()
.map(|c| ListItem::new(c.desc.as_deref().unwrap_or("-")).style(THEME.help.desc))
.collect::<Vec<_>>();
.map(|c| ListItem::new(c.desc.as_deref().unwrap_or("-")).style(THEME.help.desc.into()))
.collect();

let chunks = layout::Layout::horizontal([
Constraint::Ratio(2, 10),
Expand Down
4 changes: 2 additions & 2 deletions yazi-fm/src/select/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl<'a> Widget for Select<'a> {
let select = &self.cx.select;
let area = self.cx.area(&select.position);

let items = select
let items: Vec<_> = select
.window()
.iter()
.enumerate()
Expand All @@ -27,7 +27,7 @@ impl<'a> Widget for Select<'a> {

ListItem::new(format!(" {v}")).style(THEME.select.active)
})
.collect::<Vec<_>>();
.collect();

widgets::Clear.render(area, buf);
List::new(items)
Expand Down

0 comments on commit 8810dd3

Please sign in to comment.