Skip to content

Commit

Permalink
[Clippy] Remove dead/unused code.
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulJuliusMartinez committed Feb 9, 2022
1 parent 182c116 commit e9f78b2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 33 deletions.
23 changes: 0 additions & 23 deletions src/flatjson.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,20 +260,6 @@ pub enum ContainerType {
}

impl ContainerType {
pub fn open_char(&self) -> char {
match self {
ContainerType::Object => '{',
ContainerType::Array => '[',
}
}

pub fn close_char(&self) -> char {
match self {
ContainerType::Object => '}',
ContainerType::Array => ']',
}
}

pub fn open_str(&self) -> &'static str {
match self {
ContainerType::Object => "{",
Expand All @@ -288,13 +274,6 @@ impl ContainerType {
}
}

pub fn type_str(&self) -> &'static str {
match self {
ContainerType::Object => "Object",
ContainerType::Array => "Array",
}
}

pub fn collapsed_preview(&self) -> &'static str {
match self {
ContainerType::Object => "{…}",
Expand Down Expand Up @@ -649,8 +628,6 @@ mod tests {
"11": 11
}"#;

const OBJECT_LINES: usize = 13;

const NESTED_OBJECT: &str = r#"[
{
"2": [
Expand Down
5 changes: 5 additions & 0 deletions src/lineprinter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,12 @@ impl<'a, 'b, 'c> LinePrinter<'a, 'b, 'c> {
// If we're not the first child, the previous elem will have
// printed the ", " separator.
self.highlight_str("…", None, highlighting::PREVIEW_STYLES)?;

// This variable technically isn't used again, but for "correctness"
// we'll keep it in case we do use the variable later, or code gets
// moved around.
available_space -= 1;

num_printed += 1;
break;
} else {
Expand Down
3 changes: 0 additions & 3 deletions src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ pub struct SearchState {
pub direction: SearchDirection,

pub search_term: String,
compiled_regex: Regex,

matches: Vec<Range<usize>>,

Expand Down Expand Up @@ -63,7 +62,6 @@ impl SearchState {
SearchState {
direction: SearchDirection::Forward,
search_term: "".to_owned(),
compiled_regex: Regex::new("").unwrap(),
matches: vec![],
immediate_state: ImmediateSearchState::NotSearching,
ever_searched: false,
Expand Down Expand Up @@ -132,7 +130,6 @@ impl SearchState {
Ok(SearchState {
direction,
search_term: regex_input.to_owned(),
compiled_regex: regex,
matches,
immediate_state: ImmediateSearchState::NotSearching,
ever_searched: true,
Expand Down
15 changes: 8 additions & 7 deletions src/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@ pub enum Color {
Default,
}

// Commented out colors are unused.
pub const BLACK: Color = Color::C16(0);
pub const RED: Color = Color::C16(1);
pub const GREEN: Color = Color::C16(2);
pub const YELLOW: Color = Color::C16(3);
pub const BLUE: Color = Color::C16(4);
pub const MAGENTA: Color = Color::C16(5);
pub const CYAN: Color = Color::C16(6);
// pub const CYAN: Color = Color::C16(6);
pub const WHITE: Color = Color::C16(7);
pub const LIGHT_BLACK: Color = Color::C16(8);
pub const LIGHT_RED: Color = Color::C16(9);
pub const LIGHT_GREEN: Color = Color::C16(10);
pub const LIGHT_YELLOW: Color = Color::C16(11);
// pub const LIGHT_RED: Color = Color::C16(9);
// pub const LIGHT_GREEN: Color = Color::C16(10);
// pub const LIGHT_YELLOW: Color = Color::C16(11);
pub const LIGHT_BLUE: Color = Color::C16(12);
pub const LIGHT_MAGENTA: Color = Color::C16(13);
pub const LIGHT_CYAN: Color = Color::C16(14);
pub const LIGHT_WHITE: Color = Color::C16(15);
// pub const LIGHT_MAGENTA: Color = Color::C16(13);
// pub const LIGHT_CYAN: Color = Color::C16(14);
// pub const LIGHT_WHITE: Color = Color::C16(15);
pub const DEFAULT: Color = Color::Default;

#[derive(Copy, Clone)]
Expand Down
1 change: 1 addition & 0 deletions src/viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ impl JsonViewer {
#[derive(Debug, Copy, Clone)]
pub enum Action {
// Does nothing, for debugging, shouldn't modify any state.
#[allow(dead_code)]
NoOp,

MoveUp(usize),
Expand Down

0 comments on commit e9f78b2

Please sign in to comment.