Skip to content

Commit

Permalink
refactor: i do as clippy demands 🫡
Browse files Browse the repository at this point in the history
  • Loading branch information
uncenter committed Jun 10, 2024
1 parent 8203728 commit 6a58683
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,17 @@ static THINK_CHARS: Chars = Chars {
angled_down_right: "⎝",
angled_down_left: "⎠",
};
pub fn generate(message: &str, format_opts: FormatOptions) -> String {

#[must_use]
pub fn generate(message: &str, format_opts: &FormatOptions) -> String {
let think = format_opts.think;
let width = format_opts.width;

let chars = if think { &THINK_CHARS } else { &SAY_CHARS };
let mut lines = wrap(&message, width as usize);
let mut lines = wrap(message, width as usize);
let longest = lines.iter().map(|line| line.width()).max().unwrap();
return format!(

format!(
"
{}
{}
Expand Down Expand Up @@ -106,5 +109,5 @@ pub fn generate(message: &str, format_opts: FormatOptions) -> String {
chars.bottom.repeat(longest),
chars.arrow,
chars.arrow,
);
)
}
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn main() -> Result<()> {
width,
};

let msg = generate(&args.message, format_opts);
let msg = generate(&args.message, &format_opts);

let mut msg_color = console::Color::White;
let mut cat_color = console::Color::White;
Expand Down

0 comments on commit 6a58683

Please sign in to comment.