thanks clippy

pull/33/head
chris west 2 years ago
parent 89b5febd4b
commit 9baac849e5

@ -143,7 +143,7 @@ fn print_plain(url: &str, tls: bool, tor: bool) -> Result<(), Box<dyn Error>> {
/// Print current theme as plaintext /// Print current theme as plaintext
fn print_theme(cfg: Config) -> Result<(), Box<dyn Error>> { fn print_theme(cfg: Config) -> Result<(), Box<dyn Error>> {
println!("{}", cfg.theme.to_string()); println!("{}", cfg.theme);
Ok(()) Ok(())
} }

@ -983,7 +983,7 @@ pub fn parse(url: &str, raw: String, config: Config) -> Menu {
tor: false, tor: false,
wide: false, wide: false,
scroll: 0, scroll: 0,
config: config, config,
} }
} }

@ -1,5 +1,6 @@
//! Terminal color scheme. //! Terminal color scheme.
//! Provides the Theme struct and functions/macros for making use of it. //! Provides the Theme struct and functions/macros for making use of it.
use std::fmt;
/// Provides a shortcut to the Reset color code. /// Provides a shortcut to the Reset color code.
pub mod color { pub mod color {
@ -59,28 +60,28 @@ pub struct Theme {
impl Default for Theme { impl Default for Theme {
fn default() -> Theme { fn default() -> Theme {
Theme { Theme {
ui_cursor: to_color("white bold").into(), ui_cursor: to_color("white bold"),
ui_number: to_color("magenta").into(), ui_number: to_color("magenta"),
ui_menu: to_color("yellow").into(), ui_menu: to_color("yellow"),
ui_text: to_color("white").into(), ui_text: to_color("white"),
item_text: to_color("cyan").into(), item_text: to_color("cyan"),
item_menu: to_color("blue").into(), item_menu: to_color("blue"),
item_error: to_color("red").into(), item_error: to_color("red"),
item_search: to_color("white").into(), item_search: to_color("white"),
item_telnet: to_color("grey").into(), item_telnet: to_color("grey"),
item_external: to_color("green").into(), item_external: to_color("green"),
item_download: to_color("white underline").into(), item_download: to_color("white underline"),
item_media: to_color("green underline").into(), item_media: to_color("green underline"),
item_unsupported: to_color("whitebg red").into(), item_unsupported: to_color("whitebg red"),
} }
} }
} }
impl Theme { impl fmt::Display for Theme {
/// Return theme file for this theme fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
pub fn to_string(&self) -> String { write!(
format!( f,
"# phetch theme "# phetch theme
ui.cursor {ui_cursor} ui.cursor {ui_cursor}
ui.number {ui_number} ui.number {ui_number}

Loading…
Cancel
Save