fix: resolve all 23 clippy warnings
Some checks failed
ci/woodpecker/pr/check Pipeline failed
CI / Check (pull_request) Has been cancelled
CI / Format (pull_request) Has been cancelled
CI / Clippy (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
CI / Build (windows-latest) (pull_request) Has been cancelled

This commit is contained in:
Mikhail Kilin
2026-02-22 17:28:50 +03:00
parent d9eb61dda7
commit d4e1ed1376
14 changed files with 49 additions and 92 deletions

View File

@@ -21,7 +21,7 @@ pub fn render_emoji_picker(
) {
// Размеры модалки (зависят от количества реакций)
let emojis_per_row = 8;
let rows = (available_reactions.len() + emojis_per_row - 1) / emojis_per_row;
let rows = available_reactions.len().div_ceil(emojis_per_row);
let modal_width = 50u16;
let modal_height = (rows + 4) as u16; // +4 для заголовка, отступов и подсказки

View File

@@ -401,12 +401,10 @@ pub fn render_message_bubble(
} else {
format!("[{}]", reaction.emoji)
}
} else if reaction.count > 1 {
format!("{} {}", reaction.emoji, reaction.count)
} else {
if reaction.count > 1 {
format!("{} {}", reaction.emoji, reaction.count)
} else {
reaction.emoji.clone()
}
reaction.emoji.clone()
};
let style = if reaction.is_chosen {
@@ -548,7 +546,7 @@ pub fn render_album_bubble(
let mut deferred: Vec<DeferredImageRender> = Vec::new();
let is_selected = messages.iter().any(|m| selected_msg_id == Some(m.id()));
let is_outgoing = messages.first().map_or(false, |m| m.is_outgoing());
let is_outgoing = messages.first().is_some_and(|m| m.is_outgoing());
// Selection marker
let selection_marker = if is_selected { "" } else { "" };
@@ -567,7 +565,7 @@ pub fn render_album_bubble(
// Grid layout
let cols = photo_count.min(ALBUM_GRID_MAX_COLS);
let rows = (photo_count + cols - 1) / cols;
let rows = photo_count.div_ceil(cols);
// Добавляем маркер выбора на первую строку
if is_selected {

View File

@@ -309,11 +309,7 @@ fn render_message_list<T: TdClientTrait>(f: &mut Frame, area: Rect, app: &mut Ap
let total_lines = lines.len();
// Базовый скролл (показываем последние сообщения)
let base_scroll = if total_lines > visible_height {
total_lines - visible_height
} else {
0
};
let base_scroll = total_lines.saturating_sub(visible_height);
// Если выбрано сообщение, автоскроллим к нему
let scroll_offset = if app.is_selecting_message() {
@@ -431,7 +427,7 @@ pub fn render<T: TdClientTrait>(f: &mut Frame, area: Rect, app: &mut App<T>) {
1
};
// Минимум 3 строки (1 контент + 2 рамки), максимум 10
let input_height = (input_lines + 2).min(10).max(3);
let input_height = (input_lines + 2).clamp(3, 10);
// Проверяем, есть ли закреплённое сообщение
let has_pinned = app.td_client.current_pinned_message().is_some();