chore(tahuantinsuyu): fase 28 — limpieza de warnings y dead_code

- Reemplaza `Context<Self>` por `Context<'_, Self>` (y la misma
  fórmula para `Context<TahuantinsuyuTree>`) en tree/panel/canvas:
  60 warnings de "hidden lifetime parameters are deprecated" → 0.
- Borra `TREE_WIDTH` y `PANEL_HEIGHT` (constantes muertas) y el
  campo `main_split` del shell (vive como child de outer_split,
  no necesita retención aparte).
- Quita `yahweh-bus` de tahuantinsuyu — el `bus: Entity<AppBus>`
  estaba con `#[allow(dead_code)]` sin cablear. Cuando lo
  necesitemos para coordinación cross-app lo reagregamos.
- Suprime imports `Module` (panel), `AppContext` (canvas) y
  prefija el `cx` no usado en `on_jog_down`.
- Marca `BrahmanStatus::Offline.reason` y `Shell.tree` con
  `#[allow(dead_code)]` documentando por qué se retienen
  (logs y subscripciones).

Workspace ahora compila limpio salvo un warning conocido de
`eternal-validation` (variable `sin_i` sin usar — fuera de
brahman).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
sergio
2026-05-18 00:28:17 +00:00
parent a4d1e0dc17
commit 2192c29d4f
6 changed files with 77 additions and 81 deletions
@@ -330,7 +330,7 @@ pub fn parse_city_atlas_tsv(content: &str) -> Vec<CityPreset> {
impl EventEmitter<TreeEvent> for TahuantinsuyuTree {}
impl TahuantinsuyuTree {
pub fn new(store: Store, cx: &mut Context<Self>) -> Self {
pub fn new(store: Store, cx: &mut Context<'_, Self>) -> Self {
cx.observe_global::<Theme>(|_, cx| cx.notify()).detach();
let inner = cx.new(|cx| TreeView::new("tahuantinsuyu-tree", cx));
@@ -373,14 +373,14 @@ impl TahuantinsuyuTree {
/// Reemplaza el atlas de ciudades del dropdown. La app llama esto
/// al boot si encuentra un archivo TSV custom en disco.
pub fn set_city_atlas(&mut self, atlas: Vec<CityPreset>, cx: &mut Context<Self>) {
pub fn set_city_atlas(&mut self, atlas: Vec<CityPreset>, cx: &mut Context<'_, Self>) {
if !atlas.is_empty() {
self.city_atlas = atlas;
cx.notify();
}
}
pub fn refresh(&mut self, cx: &mut Context<Self>) {
pub fn refresh(&mut self, cx: &mut Context<'_, Self>) {
let mut rows = Vec::new();
self.append_groups(None, 0, &mut rows);
self.append_contacts(None, 0, &mut rows);
@@ -391,7 +391,7 @@ impl TahuantinsuyuTree {
/// Cuando hay filtro, expande automáticamente los ancestros que
/// contienen matches para que el usuario vea los resultados sin
/// tener que clickear chevrons.
fn set_search_filter(&mut self, filter: String, cx: &mut Context<Self>) {
fn set_search_filter(&mut self, filter: String, cx: &mut Context<'_, Self>) {
self.search_filter = filter.trim().to_lowercase();
if !self.search_filter.is_empty() {
self.auto_expand_matches();
@@ -584,7 +584,7 @@ impl TahuantinsuyuTree {
}
}
fn on_inner(&mut self, ev: &InnerTreeEvent, cx: &mut Context<Self>) {
fn on_inner(&mut self, ev: &InnerTreeEvent, cx: &mut Context<'_, Self>) {
match ev {
InnerTreeEvent::ChevronToggled(id) => {
let s = id.as_str().to_string();
@@ -626,20 +626,20 @@ impl TahuantinsuyuTree {
// Acciones del menú
// -----------------------------------------------------------------
fn close_menu(&mut self, cx: &mut Context<Self>) {
fn close_menu(&mut self, cx: &mut Context<'_, Self>) {
if self.menu.take().is_some() {
cx.notify();
}
}
fn close_modal(&mut self, cx: &mut Context<Self>) {
fn close_modal(&mut self, cx: &mut Context<'_, Self>) {
if self.modal.take().is_some() {
self.city_picker_open = false;
cx.notify();
}
}
fn toggle_city_picker(&mut self, cx: &mut Context<Self>) {
fn toggle_city_picker(&mut self, cx: &mut Context<'_, Self>) {
self.city_picker_open = !self.city_picker_open;
cx.notify();
}
@@ -647,7 +647,7 @@ impl TahuantinsuyuTree {
/// Aplica un city preset al ChartForm activo (CreateChart o
/// EditChart). Setea place, lat, lon, tz_offset_min vía
/// `TextInput::set_text` y cierra el picker.
fn apply_city_preset(&mut self, preset: &CityPreset, cx: &mut Context<Self>) {
fn apply_city_preset(&mut self, preset: &CityPreset, cx: &mut Context<'_, Self>) {
let form = match self.modal.as_mut() {
Some(Modal::CreateChart { form, .. }) => form,
Some(Modal::EditChart { form, .. }) => form,
@@ -677,7 +677,7 @@ impl TahuantinsuyuTree {
&mut self,
parent: Option<GroupId>,
window: &mut Window,
cx: &mut Context<Self>,
cx: &mut Context<'_, Self>,
) {
let input = self.make_input("Nombre del grupo", "", window, cx);
self.modal = Some(Modal::CreateGroup { parent, input });
@@ -688,7 +688,7 @@ impl TahuantinsuyuTree {
&mut self,
group: Option<GroupId>,
window: &mut Window,
cx: &mut Context<Self>,
cx: &mut Context<'_, Self>,
) {
let input = self.make_input("Nombre del contacto", "", window, cx);
self.modal = Some(Modal::CreateContact { group, input });
@@ -699,7 +699,7 @@ impl TahuantinsuyuTree {
&mut self,
id: ChartId,
window: &mut Window,
cx: &mut Context<Self>,
cx: &mut Context<'_, Self>,
) {
// Cargar la carta existente; si no se puede, fallamos en silencio.
let chart = match self.store.get_chart(id) {
@@ -751,7 +751,7 @@ impl TahuantinsuyuTree {
&mut self,
contact: ContactId,
window: &mut Window,
cx: &mut Context<Self>,
cx: &mut Context<'_, Self>,
) {
// Pre-cargamos el nombre del contacto en el campo "Sujeto" del
// form como conveniencia — la mayoría de las cartas se nombran
@@ -795,7 +795,7 @@ impl TahuantinsuyuTree {
self.close_menu(cx);
}
fn open_rename(&mut self, target: MenuTarget, window: &mut Window, cx: &mut Context<Self>) {
fn open_rename(&mut self, target: MenuTarget, window: &mut Window, cx: &mut Context<'_, Self>) {
let modal = match target {
MenuTarget::Group(id) => {
let current = self
@@ -847,7 +847,7 @@ impl TahuantinsuyuTree {
placeholder: &str,
initial: &str,
window: &mut Window,
cx: &mut Context<Self>,
cx: &mut Context<'_, Self>,
) -> Entity<TextInput> {
let placeholder = placeholder.to_string();
let input = cx.new(|cx| {
@@ -862,14 +862,14 @@ impl TahuantinsuyuTree {
input
}
fn on_input_event(&mut self, ev: &TextInputEvent, cx: &mut Context<Self>) {
fn on_input_event(&mut self, ev: &TextInputEvent, cx: &mut Context<'_, Self>) {
match ev {
TextInputEvent::Cancelled => self.close_modal(cx),
TextInputEvent::Confirmed(value) => self.submit_modal(value.clone(), cx),
}
}
fn submit_modal(&mut self, value: String, cx: &mut Context<Self>) {
fn submit_modal(&mut self, value: String, cx: &mut Context<'_, Self>) {
let trimmed = value.trim().to_string();
// Tomamos ownership del modal — si el submit falla en mitad,
// lo restablecemos. Esto evita un borrow-mut sobre self.modal.
@@ -1012,7 +1012,7 @@ impl TahuantinsuyuTree {
}
}
fn after_mutation(&mut self, cx: &mut Context<Self>) {
fn after_mutation(&mut self, cx: &mut Context<'_, Self>) {
self.modal = None;
self.refresh(cx);
cx.emit(TreeEvent::HierarchyChanged);
@@ -1023,7 +1023,7 @@ impl TahuantinsuyuTree {
&mut self,
target: MenuTarget,
window: &mut Window,
cx: &mut Context<Self>,
cx: &mut Context<'_, Self>,
) {
let (label, kind) = match target {
MenuTarget::Group(_) => ("este grupo (incluye sus subgrupos y contactos)", "group"),
@@ -1072,7 +1072,7 @@ impl TahuantinsuyuTree {
fn build_chart_from_form(
form: &ChartForm,
cx: &mut Context<TahuantinsuyuTree>,
cx: &mut Context<'_, TahuantinsuyuTree>,
) -> Result<(StoredBirthData, String), String> {
let name = form.name.read(cx).text().trim().to_string();
let place = form.place.read(cx).text().trim().to_string();
@@ -1208,7 +1208,7 @@ fn parse_row(id: &RowId) -> Option<TreeSelection> {
const MENU_WIDTH: f32 = 220.0;
impl Render for TahuantinsuyuTree {
fn render(&mut self, _w: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
fn render(&mut self, _w: &mut Window, cx: &mut Context<'_, Self>) -> impl IntoElement {
let theme = Theme::global(cx).clone();
let search_bar = div()
.px(px(6.0))
@@ -1242,7 +1242,7 @@ impl TahuantinsuyuTree {
&self,
theme: &Theme,
menu: MenuState,
cx: &mut Context<Self>,
cx: &mut Context<'_, Self>,
) -> impl IntoElement {
let mut items = div()
.flex()
@@ -1353,7 +1353,7 @@ impl TahuantinsuyuTree {
.child(items)
}
fn render_modal(&self, theme: &Theme, cx: &mut Context<Self>) -> impl IntoElement {
fn render_modal(&self, theme: &Theme, cx: &mut Context<'_, Self>) -> impl IntoElement {
let modal = self.modal.as_ref().expect("render_modal sin modal activo");
let inner = match modal {
Modal::RenameGroup { input, .. }
@@ -1454,7 +1454,7 @@ fn render_chart_form(
title: &str,
form: &ChartForm,
error: Option<SharedString>,
cx: &mut Context<TahuantinsuyuTree>,
cx: &mut Context<'_, TahuantinsuyuTree>,
) -> gpui::Div {
let labeled = |label: &'static str, input: Entity<TextInput>| -> gpui::Div {
div()