From 35296f13b038312a91902bf91f1afdb7095e9847 Mon Sep 17 00:00:00 2001 From: Uncle Stretch Date: Sun, 21 Dec 2025 16:47:19 +0300 Subject: [PATCH] rustfmt project and change binary name Signed-off-by: Uncle Stretch --- Cargo.lock | 2 +- Cargo.toml | 4 ++-- src/bin/main.rs | 2 +- src/ui/tui.rs | 25 ++++++++++++++----------- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f358aef..dc65ea0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1270,7 +1270,7 @@ dependencies = [ ] [[package]] -name = "ghost-gossiper" +name = "ghost-echo" version = "0.0.1" dependencies = [ "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 2e9bf88..030b14e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "ghost-echo" -version = "0.0.1" +version = "0.0.2" edition = "2021" [[bin]] -name = "ghost-gossiper" +name = "ghost-echo" path = "src/bin/main.rs" [dependencies] diff --git a/src/bin/main.rs b/src/bin/main.rs index 730ac89..733cc5d 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -1,4 +1,4 @@ -use ghost_gossiper::prelude::*; +use ghost_echo::prelude::*; use anyhow::Result; use clap::Parser; diff --git a/src/ui/tui.rs b/src/ui/tui.rs index b005528..2214e86 100644 --- a/src/ui/tui.rs +++ b/src/ui/tui.rs @@ -19,7 +19,11 @@ use ratatui::{ Terminal, }; use std::{ - collections::{HashSet, VecDeque}, hash::{DefaultHasher, Hash, Hasher}, io, option::Option, time::Duration + collections::{HashSet, VecDeque}, + hash::{DefaultHasher, Hash, Hasher}, + io, + option::Option, + time::Duration, }; use tokio::sync::mpsc::{self, Receiver, Sender}; use tokio_util::sync::CancellationToken; @@ -243,7 +247,8 @@ fn wrap_text<'a>(line: Line<'a>, max_width: usize) -> Vec> { return vec![Line::from("")]; } - let leading_whitespace = words_with_styles[0].0 + let leading_whitespace = words_with_styles[0] + .0 .chars() .take_while(|c| c.is_whitespace()) .collect::(); @@ -427,15 +432,13 @@ impl<'a> ChatWidget<'a> { let color_index = (hash % 216) as u8 + 16; - self.chat.add_line( - Line::from(vec![ - time_str.to_string().into(), - " ".into(), - peer.fg(Color::Indexed(color_index)), - ": ".into(), - message.into().into() - ]) - ) + self.chat.add_line(Line::from(vec![ + time_str.to_string().into(), + " ".into(), + peer.fg(Color::Indexed(color_index)), + ": ".into(), + message.into().into(), + ])) } }