Skip to content

Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.

refactor: remove redundant comments and docstrings

Samir Hossains2340dbf80cd9
diff --git a/src/config.rs b/src/config.rs
index 92918e4..ab3c002 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -40,14 +40,6 @@ impl Default for Config {
pub const APP_NAME: &str = "moviebox-tui";
-/// Test-only escape hatch: several tests exercise `HistoryManager`/
-/// `FavoritesManager`/`Config` save paths directly, which write to whatever
-/// these functions return with no other isolation. Without this override
-/// those saves land on the real, shared config/data directories — on a
-/// machine where the app is also installed for actual use, that silently
-/// overwrites real user data with test fixtures. Set `MOVIEBOX_CONFIG_DIR`
-/// / `MOVIEBOX_DATA_DIR` to a throwaway directory before running `cargo
-/// test` to avoid this; production behavior (unset) is unchanged.
pub fn config_dir() -> Option<PathBuf> {
if let Ok(dir) = std::env::var("MOVIEBOX_CONFIG_DIR") {
return Some(PathBuf::from(dir));
diff --git a/src/favorites.rs b/src/favorites.rs
index ebb5862..6277f89 100644
--- a/src/favorites.rs
+++ b/src/favorites.rs
@@ -75,8 +75,6 @@ impl FavoritesManager {
.any(|item| item.identity().matches(identity))
}
- /// Toggles the given item and returns `true` if it is now favorited,
- /// `false` if it was just removed.
pub fn toggle(&mut self, item: FavoriteItem) -> bool {
let now_favorited = if let Some(pos) = self
.items
diff --git a/src/models.rs b/src/models.rs
index 7462ab8..9c7f668 100644
--- a/src/models.rs
+++ b/src/models.rs
@@ -3,9 +3,6 @@ use serde::{Deserialize, Serialize};
use std::collections::{HashMap, HashSet};
use std::time::{Duration, Instant};
-/// Cross-provider identity rules shared by watch history and favorites: same
-/// `stype`, same provider (canonicalized via `ProviderKind::parse`), then
-/// `subject_id` if both are non-empty, else cleaned title plus release year.
#[derive(Debug, Clone, Copy)]
pub struct SubjectIdentity<'a> {
pub provider: &'a str,
diff --git a/src/tui/app/mouse.rs b/src/tui/app/mouse.rs
index 773ff2a..94f0dc5 100644
--- a/src/tui/app/mouse.rs
+++ b/src/tui/app/mouse.rs
@@ -405,9 +405,6 @@ impl App {
None
}
- /// Mirrors the layout math in `screens::home::render_favorites_landing`
- /// so hitboxes stay in sync with what's drawn. Returns `true` if the
- /// click landed inside the favorites card (handled either way).
fn handle_favorites_landing_click(&mut self, col: u16, row: u16, area: Rect) -> bool {
let row_count = self.state.favorites_landing_items().len() as u16;
if row_count == 0 || area.height < 2 || area.width < 20 {
@@ -434,7 +431,6 @@ impl App {
let rel_row = row - card.y;
if rel_row == 0 {
- // Header row; no action.
} else if rel_row <= row_count {
let idx = (rel_row - 1) as usize;
let prev_selected = if self.state.favorites_focus {
diff --git a/src/tui/screens/home.rs b/src/tui/screens/home.rs
index 057b3d2..caa12e3 100644
--- a/src/tui/screens/home.rs
+++ b/src/tui/screens/home.rs
@@ -771,8 +771,6 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)
.split(text_area);
let title_style = if is_selected { theme.title } else { theme.text };
- // TV channels are never favoritable (see current_favorite_candidate), so
- // this is always false for TV mode's channel list, keeping it byte-identical.
let is_favorited = res.stype != 3
&& state
.favorites
diff --git a/src/tui/state.rs b/src/tui/state.rs
index 26d6308..5a032bf 100644
--- a/src/tui/state.rs
+++ b/src/tui/state.rs
@@ -153,9 +153,6 @@ pub struct AppState {
pub subtitle_popup: bool,
pub is_download_subtitle_popup: bool,
- /// None means the season has not chosen a subtitle policy; Some(None)
- /// records an explicit no-subtitles choice, and Some(Some(language))
- /// records the selected language.
pub season_subtitle_preference: Option<Option<String>>,
pub last_download_subtitle_language: Option<String>,
pub subtitle_list: Vec<(String, String)>,
@@ -437,8 +434,6 @@ impl AppState {
self.details_pane = DetailsPane::Streams;
}
- /// Same availability predicate `/history` and `/browse` already use:
- /// Streaming and Addon modes only.
pub fn favorites_available(&self) -> bool {
(self.streaming_enabled && !self.is_tv_mode && !self.is_addon_mode)
|| (self.addons_enabled && self.is_addon_mode)
@@ -448,9 +443,6 @@ impl AppState {
self.favorites_available() && !self.favorites.items.is_empty()
}
- /// Up to 5 most-recently-favorited titles, newest first. This is the
- /// fixed set the landing row navigates over; the rest are reachable via
- /// `/favorites`.
pub fn favorites_landing_items(&self) -> Vec<&crate::favorites::FavoriteItem> {
let mut items: Vec<&crate::favorites::FavoriteItem> = self.favorites.items.iter().collect();
items.sort_by_key(|item| std::cmp::Reverse(item.added_at));
diff --git a/tests/favorites_lifecycle.rs b/tests/favorites_lifecycle.rs
index 089ac43..06aa24e 100644
--- a/tests/favorites_lifecycle.rs
+++ b/tests/favorites_lifecycle.rs
@@ -26,8 +26,6 @@ fn dummy_favorite(
#[test]
fn test_favorites_path_is_outside_clear_cache_scope() {
- // /clear-cache (crate::cache::clear_all_cache) only removes cache_dir()
- // and data_dir()/iptv_cache. favorites.json must live outside both.
let favorites_path = moviebox_tui::config::favorites_path().expect("favorites path");
let cache_dir = moviebox_tui::config::cache_dir();
let data_dir = moviebox_tui::config::data_dir().expect("data dir");