mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 21:44:16 +00:00
Remove yet more dead code
This commit is contained in:
parent
6b4dbf3b05
commit
2d35d3f3c7
11 changed files with 12 additions and 76 deletions
|
@ -35,6 +35,7 @@ pub fn term() -> Option<Arc<Term>> {
|
|||
|
||||
/// The safe wrapper around curses functionality, initialized by a successful call to [`setup()`]
|
||||
/// and obtained thereafter by calls to [`term()`].
|
||||
#[allow(dead_code)]
|
||||
#[derive(Default)]
|
||||
pub struct Term {
|
||||
// String capabilities. Any Some value is confirmed non-empty.
|
||||
|
|
|
@ -42,16 +42,6 @@ pub struct CallbackData {
|
|||
// The value of the variable, or none if it is erased.
|
||||
pub val: Option<EnvVar>,
|
||||
}
|
||||
impl CallbackData {
|
||||
/// Construct from a key and maybe a value.
|
||||
pub fn new(key: WString, val: Option<EnvVar>) -> Self {
|
||||
Self { key, val }
|
||||
}
|
||||
/// Return whether this callback represents an erased variable.
|
||||
pub fn is_erase(&self) -> bool {
|
||||
self.val.is_none()
|
||||
}
|
||||
}
|
||||
|
||||
pub type CallbackDataList = Vec<CallbackData>;
|
||||
|
||||
|
@ -358,6 +348,7 @@ impl EnvUniversal {
|
|||
}
|
||||
|
||||
/// Exposed for testing only.
|
||||
#[cfg(test)]
|
||||
pub fn is_ok_to_save(&self) -> bool {
|
||||
self.ok_to_save
|
||||
}
|
||||
|
@ -591,7 +582,10 @@ impl EnvUniversal {
|
|||
|
||||
// If the value is not present in new_vars, it has been erased.
|
||||
if !new_vars.contains_key(key) {
|
||||
callbacks.push(CallbackData::new(key.clone(), None));
|
||||
callbacks.push(CallbackData {
|
||||
key: key.clone(),
|
||||
val: None,
|
||||
});
|
||||
if value.exports() {
|
||||
self.export_generation += 1;
|
||||
}
|
||||
|
@ -616,7 +610,10 @@ impl EnvUniversal {
|
|||
}
|
||||
if existing.is_none() || export_changed || value_changed {
|
||||
// Value is set for the first time, or has changed.
|
||||
callbacks.push(CallbackData::new(key.clone(), Some(new_entry.clone())));
|
||||
callbacks.push(CallbackData {
|
||||
key: key.clone(),
|
||||
val: Some(new_entry.clone()),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -222,11 +222,6 @@ pub enum ItemAction {
|
|||
}
|
||||
|
||||
impl FdMonitorItem {
|
||||
/// Returns the id for this `FdMonitorItem` that is registered with the [`FdMonitor`].
|
||||
pub fn id(&self) -> FdMonitorItemId {
|
||||
self.item_id
|
||||
}
|
||||
|
||||
/// Return the duration until the timeout should trigger or `None`. A return of `0` means we are
|
||||
/// at or past the timeout.
|
||||
fn remaining_time(&self, now: &Instant) -> Option<Duration> {
|
||||
|
|
|
@ -3,11 +3,6 @@ use std::os::unix::prelude::*;
|
|||
|
||||
pub use fd_readable_set_t as FdReadableSet;
|
||||
|
||||
/// Create a new fd_readable_set_t.
|
||||
pub fn new_fd_readable_set() -> Box<fd_readable_set_t> {
|
||||
Box::new(fd_readable_set_t::new())
|
||||
}
|
||||
|
||||
/// Returns `true` if the fd is or becomes readable within the given timeout.
|
||||
/// This returns `false` if the waiting is interrupted by a signal.
|
||||
pub fn is_fd_readable(fd: i32, timeout_usec: u64) -> bool {
|
||||
|
|
|
@ -22,26 +22,6 @@ impl NulTerminatedString for CStr {
|
|||
pub trait AsNullTerminatedArray {
|
||||
type CharType;
|
||||
fn get(&self) -> *mut *const Self::CharType;
|
||||
fn iter(&self) -> NullTerminatedArrayIterator<Self::CharType> {
|
||||
NullTerminatedArrayIterator { ptr: self.get() }
|
||||
}
|
||||
}
|
||||
|
||||
// TODO This should expose strings as CStr.
|
||||
pub struct NullTerminatedArrayIterator<CharType> {
|
||||
ptr: *mut *const CharType,
|
||||
}
|
||||
impl<CharType> Iterator for NullTerminatedArrayIterator<CharType> {
|
||||
type Item = *const CharType;
|
||||
fn next(&mut self) -> Option<*const CharType> {
|
||||
let result = unsafe { *self.ptr };
|
||||
if result.is_null() {
|
||||
None
|
||||
} else {
|
||||
self.ptr = unsafe { self.ptr.add(1) };
|
||||
Some(result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// This supports the null-terminated array of NUL-terminated strings consumed by exec.
|
||||
|
@ -159,15 +139,6 @@ fn test_null_terminated_array() {
|
|||
assert_eq!(*ptr.offset(2), ptr::null());
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn test_null_terminated_array_iter() {
|
||||
let owned_strs = &[CString::new("foo").unwrap(), CString::new("bar").unwrap()];
|
||||
let strs: Vec<_> = owned_strs.iter().map(|s| s.as_c_str()).collect();
|
||||
let arr = NullTerminatedArray::new(&strs);
|
||||
let v1: Vec<_> = arr.iter().collect();
|
||||
let v2: Vec<_> = owned_strs.iter().map(|s| s.as_ptr()).collect();
|
||||
assert_eq!(v1, v2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_owning_null_terminated_array() {
|
||||
|
|
12
src/pager.rs
12
src/pager.rs
|
@ -1222,15 +1222,3 @@ fn process_completions_into_infos(lst: &[Completion]) -> Vec<PagerComp> {
|
|||
}
|
||||
result
|
||||
}
|
||||
|
||||
pub enum selection_motion_t {
|
||||
north,
|
||||
east,
|
||||
south,
|
||||
west,
|
||||
page_north,
|
||||
page_south,
|
||||
next,
|
||||
prev,
|
||||
deselect,
|
||||
}
|
||||
|
|
|
@ -45,12 +45,6 @@ impl RedirectionMode {
|
|||
}
|
||||
}
|
||||
|
||||
impl Dup2Action {
|
||||
pub fn new(src: RawFd, target: RawFd) -> Self {
|
||||
Self { src, target }
|
||||
}
|
||||
}
|
||||
|
||||
/// A struct which represents a redirection specification from the user.
|
||||
/// Here the file descriptors don't represent open files - it's purely textual.
|
||||
#[derive(Clone)]
|
||||
|
|
|
@ -1128,6 +1128,7 @@ impl LayoutCache {
|
|||
pub const PROMPT_CACHE_MAX_SIZE: usize = 12;
|
||||
|
||||
/// Return the size of the escape code cache.
|
||||
#[cfg(test)]
|
||||
pub fn esc_cache_size(&self) -> usize {
|
||||
self.esc_cache.len()
|
||||
}
|
||||
|
|
|
@ -251,11 +251,6 @@ pub static SHARED_CONTAINER: TermsizeContainer = TermsizeContainer {
|
|||
|
||||
const _: () = assert_sync::<TermsizeContainer>();
|
||||
|
||||
/// Helper to return the default termsize.
|
||||
pub fn termsize_default() -> Termsize {
|
||||
Termsize::defaults()
|
||||
}
|
||||
|
||||
/// Convenience helper to return the last known termsize.
|
||||
pub fn termsize_last() -> Termsize {
|
||||
return SHARED_CONTAINER.last();
|
||||
|
|
|
@ -81,7 +81,6 @@ impl Function {
|
|||
pub enum ErrorKind {
|
||||
UnknownFunction,
|
||||
MissingClosingParen,
|
||||
MissingOpenParen,
|
||||
TooFewArgs,
|
||||
TooManyArgs,
|
||||
MissingOperator,
|
||||
|
@ -97,7 +96,6 @@ impl ErrorKind {
|
|||
match self {
|
||||
ErrorKind::UnknownFunction => wgettext!("Unknown function"),
|
||||
ErrorKind::MissingClosingParen => wgettext!("Missing closing parenthesis"),
|
||||
ErrorKind::MissingOpenParen => wgettext!("Missing opening parenthesis"),
|
||||
ErrorKind::TooFewArgs => wgettext!("Too few arguments"),
|
||||
ErrorKind::TooManyArgs => wgettext!("Too many arguments"),
|
||||
ErrorKind::MissingOperator => wgettext!("Missing operator"),
|
||||
|
|
|
@ -37,6 +37,7 @@ pub const ANY_STRING: char = char_offset(WILDCARD_RESERVED_BASE, 1);
|
|||
pub const ANY_STRING_RECURSIVE: char = char_offset(WILDCARD_RESERVED_BASE, 2);
|
||||
/// This is a special pseudo-char that is not used other than to mark the
|
||||
/// end of the special characters so we can sanity check the enum range.
|
||||
#[allow(dead_code)]
|
||||
pub const ANY_SENTINEL: char = char_offset(WILDCARD_RESERVED_BASE, 3);
|
||||
|
||||
#[derive(PartialEq)]
|
||||
|
|
Loading…
Reference in a new issue