Some checks 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
Comprehensive cleanup of unused methods, dead code, and compiler warnings:
## Removed Methods (15):
- Duplicate delegation methods: is_authenticated, get_typing_text, get_user_name from TdClient
- Obsolete methods: TdClient::init() (duplicated in main.rs)
- Unused getters: UserCache::{get_username, get_name, get_user_id_by_chat}
- Unused builder methods: MessageBuilder::{edited, add_reaction}
- Unused utility: ChatState::is_normal()
- Dead code: HotkeysConfig::{matches, key_matches} (kept for tests)
- Unused method: UserCache::register_private_chat()
- Getter replaced with direct field access: MessageInfo::edit_date()
## Removed Module:
- error.rs - Unused error handling module (TeletuiError, ErrorVariant, IntoTeletuiError)
## Removed Constants (8):
- EMOJI_PICKER_COLUMNS, EMOJI_PICKER_ROWS, MAX_INPUT_HEIGHT
- MIN_TERMINAL_WIDTH, MIN_TERMINAL_HEIGHT
- TDLIB_CHAT_LIMIT, MAX_USERNAME_DISPLAY_LENGTH, MESSAGE_TEXT_INDENT
## Fixed Warnings:
- Removed unused imports (8 instances)
- Fixed unreachable patterns (10 instances)
- Fixed irrefutable if let patterns (2 instances)
- Fixed unused variables (1 instance)
- Removed dead_code annotations where appropriate
## Improvements:
- Integrated Config::load_credentials() into TdClient::new() for better credential management
- Replaced edit_date() getter with direct field access (message.metadata.edit_date)
- Updated tests to use direct field access instead of removed getters
## Test Results:
All tests passing: 499 passed, 0 failed
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
38 lines
1.6 KiB
Rust
38 lines
1.6 KiB
Rust
// Application constants
|
|
|
|
// ============================================================================
|
|
// Memory Limits
|
|
// ============================================================================
|
|
|
|
/// Максимальное количество сообщений в одном чате (для оптимизации памяти)
|
|
pub const MAX_MESSAGES_IN_CHAT: usize = 500;
|
|
|
|
/// Максимальный размер кэша пользователей (LRU)
|
|
pub const MAX_USER_CACHE_SIZE: usize = 500;
|
|
|
|
/// Максимальное количество чатов для загрузки
|
|
pub const MAX_CHATS: usize = 200;
|
|
|
|
/// Максимальное количество user_ids для хранения в чате
|
|
pub const MAX_CHAT_USER_IDS: usize = 500;
|
|
|
|
// ============================================================================
|
|
// Performance
|
|
// ============================================================================
|
|
|
|
/// Таймаут poll для event loop (16ms = 60 FPS)
|
|
pub const POLL_TIMEOUT_MS: u64 = 16;
|
|
|
|
/// Таймаут ожидания graceful shutdown (в секундах)
|
|
pub const SHUTDOWN_TIMEOUT_SECS: u64 = 2;
|
|
|
|
/// Количество пользователей для ленивой загрузки за один тик
|
|
pub const LAZY_LOAD_USERS_PER_TICK: usize = 5;
|
|
|
|
// ============================================================================
|
|
// TDLib
|
|
// ============================================================================
|
|
|
|
/// Лимит количества сообщений для загрузки через TDLib за раз
|
|
pub const TDLIB_MESSAGE_LIMIT: i32 = 50;
|