mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-09-21 16:02:20 +00:00
refactor: drop eight #[allow(dead_code)] that no longer allow anything
Each of these sits on an item the code does use: ssh_config's import_profiles, merge_imported and jump_alias, SshConnection's key field and key(), NativeSshSpec::without_secrets, CmdEditor::cursor, and Pane::ssh_connection. Verified by removing every dead_code allow in the workspace and reading back what the compiler then reported -- none of these appeared, in either a production-only or an all-targets build. A stale allow is worse than no allow. It reads as "this is dead, on purpose", so the next person leaves it alone, and it goes on covering the item after the code around it changes -- at which point the item really can die without anyone hearing about it. cursor_byte is the one that is genuinely unused outside tests, so it moves to the house idiom #[cfg_attr(not(test), allow(dead_code))], which still reports it if the tests stop using it too.
This commit is contained in:
@@ -1670,7 +1670,6 @@ impl DaemonPane {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn ssh_connection(&self) -> Option<Arc<crate::daemon::ssh::SshConnection>> {
|
||||
match &self.backend {
|
||||
PaneBackend::NativeSsh(b) => b.connection.lock().unwrap().upgrade(),
|
||||
|
||||
@@ -531,7 +531,6 @@ pub enum SshTestNeed {
|
||||
}
|
||||
|
||||
impl NativeSshSpec {
|
||||
#[allow(dead_code)]
|
||||
pub fn without_secrets(&self) -> NativeSshSpec {
|
||||
NativeSshSpec {
|
||||
password: None,
|
||||
|
||||
@@ -160,7 +160,6 @@ pub async fn drive_channel(
|
||||
|
||||
pub struct SshConnection {
|
||||
handle: tokio::sync::Mutex<russh::client::Handle<super::handler::ClientHandler>>,
|
||||
#[allow(dead_code)]
|
||||
key: ConnectionKey,
|
||||
remote_forwards: RemoteForwardTable,
|
||||
alive: AtomicBool,
|
||||
@@ -182,7 +181,6 @@ impl SshConnection {
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn key(&self) -> &ConnectionKey {
|
||||
&self.key
|
||||
}
|
||||
|
||||
@@ -202,7 +202,6 @@ pub struct ImportReport {
|
||||
pub files_read: usize,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn import_profiles() -> Vec<ImportedProfile> {
|
||||
let Some(home) = home_dir() else {
|
||||
return Vec::new();
|
||||
@@ -424,7 +423,6 @@ pub struct MergeStats {
|
||||
pub unchanged: usize,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn merge_imported(
|
||||
existing: &mut Vec<ManagedProfile>,
|
||||
imported: Vec<ImportedProfile>,
|
||||
@@ -486,7 +484,6 @@ pub fn merge_imported(
|
||||
stats
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn jump_alias(raw: &str) -> Option<String> {
|
||||
let first = raw.split(',').next().unwrap_or(raw).trim();
|
||||
if first.is_empty() {
|
||||
|
||||
@@ -27,12 +27,11 @@ impl CmdEditor {
|
||||
self.chars.len()
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn cursor(&self) -> usize {
|
||||
self.cursor
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[cfg_attr(not(test), allow(dead_code))]
|
||||
pub fn cursor_byte(&self) -> usize {
|
||||
self.chars[..self.cursor].iter().map(|c| c.len_utf8()).sum()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user