This commit is contained in:
sxyazi 2024-02-06 08:32:34 +08:00
parent c15fdc02e5
commit 8810dd38c7
No known key found for this signature in database
9 changed files with 18 additions and 18 deletions

View file

@ -357,7 +357,7 @@ impl Kitty {
async fn encode(img: DynamicImage) -> Result<Vec<u8>> { async fn encode(img: DynamicImage) -> Result<Vec<u8>> {
fn output(raw: &[u8], format: u8, size: (u32, u32)) -> 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 it = b64.chunks(4096).peekable();
let mut buf = Vec::with_capacity(b64.len() + it.len() * 50); let mut buf = Vec::with_capacity(b64.len() + it.len() * 50);

View file

@ -35,7 +35,7 @@ impl KittyOld {
async fn encode(img: DynamicImage) -> Result<Vec<u8>> { async fn encode(img: DynamicImage) -> Result<Vec<u8>> {
fn output(raw: &[u8], format: u8, size: (u32, u32)) -> 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 it = b64.chunks(4096).peekable();
let mut buf = Vec::with_capacity(b64.len() + it.len() * 50); let mut buf = Vec::with_capacity(b64.len() + it.len() * 50);

View file

@ -97,7 +97,7 @@ impl Filetype {
} }
.into(), .into(),
}) })
.collect::<Vec<_>>(), .collect(),
) )
} }
} }

View file

@ -35,7 +35,7 @@ impl Icon {
text: r.text, text: r.text,
style: StyleShadow { fg: r.fg, ..Default::default() }.into(), style: StyleShadow { fg: r.fg, ..Default::default() }.into(),
}) })
.collect::<Vec<_>>(), .collect(),
) )
} }
} }

View file

@ -72,7 +72,7 @@ impl InputSnap {
#[inline] #[inline]
pub(super) fn find_window(s: &str, offset: usize, limit: usize) -> Range<usize> { pub(super) fn find_window(s: &str, offset: usize, limit: usize) -> Range<usize> {
let mut width = 0; let mut width = 0;
let v = s let v: Vec<_> = s
.chars() .chars()
.enumerate() .enumerate()
.skip(offset) .skip(offset)
@ -80,7 +80,7 @@ impl InputSnap {
width += c.width().unwrap_or(0); width += c.width().unwrap_or(0);
if width < limit { Some(i) } else { None } if width < limit { Some(i) } else { None }
}) })
.collect::<Vec<_>>(); .collect();
if v.is_empty() { if v.is_empty() {
return 0..0; return 0..0;

View file

@ -26,7 +26,7 @@ impl App {
let tasks = &mut self.cx.tasks; let tasks = &mut self.cx.tasks;
tasks.progress = opt.progress; 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 { if tasks.visible {
let new = tasks.paginate(); let new = tasks.paginate();
if new.len() != tasks.summaries.len() if new.len() != tasks.summaries.len()

View file

@ -15,7 +15,7 @@ impl<'a> Completion<'a> {
impl<'a> Widget for Completion<'a> { impl<'a> Widget for Completion<'a> {
fn render(self, rect: Rect, buf: &mut Buffer) { fn render(self, rect: Rect, buf: &mut Buffer) {
let items = self let items: Vec<_> = self
.cx .cx
.completion .completion
.window() .window()
@ -37,7 +37,7 @@ impl<'a> Widget for Completion<'a> {
item item
}) })
.collect::<Vec<_>>(); .collect();
let input_area = self.cx.area(&self.cx.input.position); let input_area = self.cx.area(&self.cx.input.position);
let mut area = Position::sticky(input_area, Offset { let mut area = Position::sticky(input_area, Offset {

View file

@ -19,18 +19,18 @@ impl Widget for Bindings<'_> {
} }
// On // On
let col1 = let col1: Vec<_> =
bindings.iter().map(|c| ListItem::new(c.on()).style(THEME.help.on)).collect::<Vec<_>>(); bindings.iter().map(|c| ListItem::new(c.on()).style(THEME.help.on.into())).collect();
// Exec // Exec
let col2 = let col2: Vec<_> =
bindings.iter().map(|c| ListItem::new(c.exec()).style(THEME.help.exec)).collect::<Vec<_>>(); bindings.iter().map(|c| ListItem::new(c.exec()).style(THEME.help.exec.into())).collect();
// Desc // Desc
let col3 = bindings let col3: Vec<_> = bindings
.iter() .iter()
.map(|c| ListItem::new(c.desc.as_deref().unwrap_or("-")).style(THEME.help.desc)) .map(|c| ListItem::new(c.desc.as_deref().unwrap_or("-")).style(THEME.help.desc.into()))
.collect::<Vec<_>>(); .collect();
let chunks = layout::Layout::horizontal([ let chunks = layout::Layout::horizontal([
Constraint::Ratio(2, 10), Constraint::Ratio(2, 10),

View file

@ -16,7 +16,7 @@ impl<'a> Widget for Select<'a> {
let select = &self.cx.select; let select = &self.cx.select;
let area = self.cx.area(&select.position); let area = self.cx.area(&select.position);
let items = select let items: Vec<_> = select
.window() .window()
.iter() .iter()
.enumerate() .enumerate()
@ -27,7 +27,7 @@ impl<'a> Widget for Select<'a> {
ListItem::new(format!("{v}")).style(THEME.select.active) ListItem::new(format!("{v}")).style(THEME.select.active)
}) })
.collect::<Vec<_>>(); .collect();
widgets::Clear.render(area, buf); widgets::Clear.render(area, buf);
List::new(items) List::new(items)