Commit a7abe5aa authored by Cyril Plisko's avatar Cyril Plisko 🤔

Implement `Default` rather than derive it

parent 2cfe4986
Pipeline #14982566 passed with stage
in 1 minute and 37 seconds
......@@ -78,7 +78,7 @@ use std::ffi::OsString;
const DEFAULT_PAGER_ENV: &str = "PAGER";
/// Keeps track of the current pager state
#[derive(Debug, Default)]
#[derive(Debug)]
pub struct Pager {
pager: Option<OsString>,
env: Option<String>,
......@@ -86,6 +86,17 @@ pub struct Pager {
skip_on_notty: bool,
}
impl Default for Pager {
fn default() -> Self {
Self {
pager: None,
env: None,
on: true,
skip_on_notty: false,
}
}
}
impl Pager {
/// Creates new instance of `Pager` with default settings
pub fn new() -> Self {
......@@ -99,8 +110,7 @@ impl Pager {
Self {
pager: pager,
env: String::from(env).into(),
on: true,
skip_on_notty: false,
..Default::default()
}
}
......@@ -113,9 +123,7 @@ impl Pager {
pub fn with_pager(pager: &str) -> Self {
Self {
pager: OsString::from(pager).into(),
env: None,
on: true,
skip_on_notty: false,
..Default::default()
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment