Skip to content

Commit

Permalink
fixed clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Arteiii committed Apr 5, 2024
1 parent 9751003 commit a847b15
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ This is a casual license agreement between you (the User) and the developer (tha
We hope this license brings a smile to your face and a sense of freedom to your heart.
Now go forth, brave adventurer, and make some magic happen!

i don't even know if licenses work like this, anyway do what ever you want with it dont sue me tho (Please)
I don't even know if licenses work like this, anyway do what ever you want with it, don't sue me tho (Please)
2 changes: 1 addition & 1 deletion examples/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn main() {

spinner.stop_and_persist(
Some(&symbols::check_mark_button()),
Some(&"Successfully"),
Some("Successfully"),
Some(content_style),
);

Expand Down
2 changes: 1 addition & 1 deletion examples/multi_spinner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn main() {
let check_mark_text = check_mark_button();
let cross_mark_text = cross_mark();

let mut spinner = MultiSpinner::new();
let mut spinner = MultiSpinner::default();

// main thread operations
let spinner1 = spinner.add(PreDefined::dot_spinner11(false));
Expand Down
18 changes: 10 additions & 8 deletions src/animations/spinner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ pub struct MultiSpinner {
// index: usize,
}

impl Default for MultiSpinner {
fn default() -> Self {
Self::new()
}
}

impl MultiSpinner {
pub fn new() -> Self {
MultiSpinner {
Expand Down Expand Up @@ -66,7 +72,7 @@ impl MultiSpinner {

/// stops a spinner if the uid is invalid this does nothing
pub fn stop(&self, uid: &usize) {
if let Some(spinner) = self.spinner.lock().unwrap().get(&uid) {
if let Some(spinner) = self.spinner.lock().unwrap().get(uid) {
*spinner.should_stop.lock().unwrap() = true;
}
}
Expand All @@ -86,7 +92,7 @@ impl MultiSpinner {
for (_, spinner) in spinners.lock().unwrap().iter() {
let frames = spinner.frames.lock().unwrap().frames.clone();
let text = spinner.text.lock().unwrap().clone();
let should_stop = spinner.should_stop.lock().unwrap().clone();
let should_stop = *spinner.should_stop.lock().unwrap();
all_should_stop.push(should_stop);
all_frames.push(frames);
all_texts.push(text);
Expand Down Expand Up @@ -126,13 +132,9 @@ impl MultiSpinner {
.zip(should_stop.iter())
.filter_map(|((frame, text), should_stop)| {
if *should_stop {
Some(format!("{}", text))
Some(text.to_string())
} else {
if let Some(frame) = frame {
Some(format!("{} {}", frame, text))
} else {
None
}
frame.as_ref().map(|frame| format!("{} {}", frame, text))
}
})
.collect::<Vec<String>>()
Expand Down

0 comments on commit a847b15

Please sign in to comment.