Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatFrogDev committed Mar 18, 2024
1 parent ad0e73f commit 6d38572
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ impl Note {

// fetch IDs from database, sort and find the first gap. if it does not exist, use the length of the array + 1
let mut stmt = sqlite.prepare("SELECT id FROM saved_notes")?;
let ids: Result<Vec<usize>, _> = stmt
.query_map(params![], |row| row.get(0))?
.collect();
let ids: Result<Vec<usize>, _> = stmt.query_map(params![], |row| row.get(0))?.collect();
let mut ids = ids?;
ids.sort_unstable();
let id = ids.clone()
let id = ids
.clone()
.into_iter()
.enumerate()
.find(|(i, id)| i + 1 != *id)
Expand All @@ -40,16 +39,16 @@ impl Note {

let mut name: String;
loop {
name = input("Name:", "".to_string())?;
if name.len() > 64 {
cursor_to_origin()?;
println!(
name = input("Name:", "".to_string())?;
if name.len() > 64 {
cursor_to_origin()?;
println!(
"If you're done inputting a field, you can press Enter twice to continue or save, or Alt/Option-Q to return to the main menu.\n\n\
error: The name is too long, it must be 64 characters or less.\r"
);
} else {
break;
}
} else {
break;
}
}
let inputted_note = Note {
id: id,
Expand Down

0 comments on commit 6d38572

Please sign in to comment.