refactor: use custom Result

This commit is contained in:
graelo 2021-10-24 11:57:25 +02:00
parent 077d16311e
commit 7d1bb69c6f
8 changed files with 34 additions and 33 deletions

View file

@ -3,7 +3,7 @@ use clap::{ArgEnum, Parser};
use crate::{
error::ParseError,
textbuf::{alphabet, regexes},
ui,
ui, Result,
};
/// Main configuration, parsed from command line.
@ -78,7 +78,7 @@ pub enum HintStyleArg {
}
/// Try to parse a `&str` into a tuple of `char`s.
fn parse_chars(src: &str) -> Result<(char, char), ParseError> {
fn parse_chars(src: &str) -> Result<(char, char)> {
if src.chars().count() != 2 {
return Err(ParseError::ExpectedSurroundingPair);
}

View file

@ -4,7 +4,7 @@ use std::fmt;
use clap::{ArgEnum, Parser};
use super::basic;
use crate::{error::ParseError, textbuf::alphabet, tmux, ui};
use crate::{error::ParseError, textbuf::alphabet, tmux, ui, Result};
/// Extended configuration for handling Tmux-specific configuration (options
/// and outputs). This is only used by `tmux-copyrat` and parsed from command
@ -52,7 +52,7 @@ pub struct ConfigExt {
}
impl ConfigExt {
pub fn initialize() -> Result<ConfigExt, ParseError> {
pub fn initialize() -> Result<ConfigExt> {
let mut config_ext = ConfigExt::parse();
if !config_ext.ignore_tmux_options {