⭐
Log in to mark this repository.
clippy a
646a679 · gmorell · 2026-01-18 22:43
Files changed
modified
Cargo.toml
+4
−0
@@ -3,6 +3,10 @@ name = "ppl"
| 3 | 3 | version = "0.1.0" |
| 4 | 4 | edition = "2021" |
| 5 | 5 | |
| 6 | +[lints.clippy] | |
| 7 | +upper_case_acronyms = "allow" | |
| 8 | +large_enum_variant = "allow" | |
| 9 | + | |
| 6 | 10 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html |
| 7 | 11 | |
| 8 | 12 | [dependencies] |
modified
src/do_init.rs
+1
−2
@@ -837,8 +837,7 @@ fn render(f: &mut Frame, app: &mut Init) {
| 837 | 837 | let messages_v: Vec<ListItem> = messages |
| 838 | 838 | .iter() |
| 839 | 839 | .filter(|(_t, i)| **i != "".to_string()) |
| 840 | − .enumerate() | |
| 841 | − .map(|(_i, (t, m))| { | |
| 840 | + .map(|(t, m)| { | |
| 842 | 841 | let content = vec![Line::from(vec![ |
| 843 | 842 | Span::styled(t, Style::default().add_modifier(Modifier::BOLD)), |
| 844 | 843 | Span::raw(format!(": {}", m)), |
modified
src/do_tui.rs
+9
−23
@@ -232,25 +232,13 @@ pub async fn run_tui(
| 232 | 232 | Tabs::Calendar => {} |
| 233 | 233 | _ => {} |
| 234 | 234 | }, |
| 235 | − KeyCode::Char('d') => match app.current_tab { | |
| 236 | − Tabs::Ppl => app.ppl_show_dates = !app.ppl_show_dates, | |
| 237 | − _ => {} | |
| 238 | − }, | |
| 239 | − KeyCode::Char('r') => match app.current_tab { | |
| 240 | − Tabs::Ppl => app.ppl_show_traits = !app.ppl_show_traits, | |
| 241 | − _ => {} | |
| 242 | − }, | |
| 243 | − KeyCode::Char('i') => match app.current_tab { | |
| 244 | − Tabs::Ppl => app.ppl_show_tiers = !app.ppl_show_tiers, | |
| 245 | − _ => {} | |
| 246 | − }, | |
| 247 | − KeyCode::Char('l') => match app.current_tab { | |
| 248 | − Tabs::Ppl => app.ppl_show_relations = !app.ppl_show_relations, | |
| 249 | − _ => {} | |
| 250 | − }, | |
| 235 | + KeyCode::Char('d') => if app.current_tab == Tabs::Ppl { app.ppl_show_dates = !app.ppl_show_dates }, | |
| 236 | + KeyCode::Char('r') => if app.current_tab == Tabs::Ppl { app.ppl_show_traits = !app.ppl_show_traits }, | |
| 237 | + KeyCode::Char('i') => if app.current_tab == Tabs::Ppl { app.ppl_show_tiers = !app.ppl_show_tiers }, | |
| 238 | + KeyCode::Char('l') => if app.current_tab == Tabs::Ppl { app.ppl_show_relations = !app.ppl_show_relations }, | |
| 251 | 239 | KeyCode::Enter => { |
| 252 | − if app.current_tab == Tabs::Ppl { | |
| 253 | − if app.ppl_editing && app.ppl_detail_state.selected().is_some() { | |
| 240 | + if app.current_tab == Tabs::Ppl | |
| 241 | + && app.ppl_editing && app.ppl_detail_state.selected().is_some() { | |
| 254 | 242 | let idx = &app.ppl_detail_state.selected().unwrap(); |
| 255 | 243 | let e = app.ppl_editables.get(*idx).unwrap(); |
| 256 | 244 | if !app.ppl_field_editing { |
@@ -290,7 +278,6 @@ pub async fn run_tui(
| 290 | 278 | } |
| 291 | 279 | app.ppl_field_editing = !app.ppl_field_editing; |
| 292 | 280 | } |
| 293 | − } | |
| 294 | 281 | } |
| 295 | 282 | _ => { |
| 296 | 283 | default_editing_handler(&mut app, &key_event); |
@@ -949,7 +936,7 @@ fn render(f: &mut Frame, app: &mut Tui) {
| 949 | 936 | false => { |
| 950 | 937 | let title = match &curr.nick { |
| 951 | 938 | None => { |
| 952 | − format!("{}", curr.name.clone()) | |
| 939 | + curr.name.clone().to_string() | |
| 953 | 940 | } |
| 954 | 941 | Some(n) => { |
| 955 | 942 | format!("{} ({})", curr.name.clone(), n) |
@@ -1010,7 +997,7 @@ fn render(f: &mut Frame, app: &mut Tui) {
| 1010 | 997 | .bg(Color::Blue), |
| 1011 | 998 | ); |
| 1012 | 999 | |
| 1013 | − for u in as_upcoming.into_iter().filter(|d| d.date.do_remind == true) { | |
| 1000 | + for u in as_upcoming.iter().filter(|d| d.date.do_remind) { | |
| 1014 | 1001 | event_list.add( |
| 1015 | 1002 | // Date::from_calendar_date(start.year(), Month::try_from(4 as u8).expect("oops"), 15 as u8).expect("doubleoops"), |
| 1016 | 1003 | Date::from_calendar_date( |
@@ -1177,7 +1164,7 @@ impl From<&SigDateAndProps> for ListItem<'_> {
| 1177 | 1164 | let default = value |
| 1178 | 1165 | .trait_defaults |
| 1179 | 1166 | .iter() |
| 1180 | − .find(|q| q.key == value.date.event && q.is_date == true); | |
| 1167 | + .find(|q| q.key == value.date.event && q.is_date); | |
| 1181 | 1168 | let line = match (value.date.do_remind, default) { |
| 1182 | 1169 | (true, Some(t)) => Line::styled( |
| 1183 | 1170 | format!(" ✓ {} {:6} {}", t.symbol, n, value.date.date), |
@@ -1204,7 +1191,6 @@ impl From<&SigDateAndProps> for ListItem<'_> {
| 1204 | 1191 | |
| 1205 | 1192 | impl From<&ppl::Model> for ListItem<'_> { |
| 1206 | 1193 | fn from(value: &Model) -> Self { |
| 1207 | − value.date_up; | |
| 1208 | 1194 | let line = match value.me { |
| 1209 | 1195 | true => Line::styled(format!(" 🌟 {}", value.name), WHITE), |
| 1210 | 1196 | false => Line::styled(format!(" {}", value.name), WHITE), |
modified
src/main.rs
+5
−5
@@ -84,7 +84,7 @@ enum Commands {
| 84 | 84 | Show, |
| 85 | 85 | /// Tiers |
| 86 | 86 | Tiers, |
| 87 | − /// | |
| 87 | + /// Traits | |
| 88 | 88 | Traits, |
| 89 | 89 | /// Stats |
| 90 | 90 | Stats, |
@@ -117,10 +117,10 @@ async fn main() -> Result<(), PplError> {
| 117 | 117 | println!("ppl"); |
| 118 | 118 | // show().expect("failed2draw") |
| 119 | 119 | } |
| 120 | − Some(Commands::MOTD { .. }) => { | |
| 120 | + Some(Commands::MOTD) => { | |
| 121 | 121 | motd(&db).await?; |
| 122 | 122 | } |
| 123 | − Some(Commands::Init { .. }) => match is_init { | |
| 123 | + Some(Commands::Init) => match is_init { | |
| 124 | 124 | false => { |
| 125 | 125 | info!("Uninitialized"); |
| 126 | 126 |
@@ -145,7 +145,7 @@ async fn main() -> Result<(), PplError> {
| 145 | 145 | drop(result); |
| 146 | 146 | } |
| 147 | 147 | Some(Commands::Calendar) => {} |
| 148 | − Some(Commands::Show {}) => match is_init { | |
| 148 | + Some(Commands::Show) => match is_init { | |
| 149 | 149 | true => { |
| 150 | 150 | let ppl = Ppl::find().all(&db).await?; |
| 151 | 151 | for p in ppl { |
@@ -209,7 +209,7 @@ async fn motd(db: &DatabaseConnection) -> Result<(), PplError> {
| 209 | 209 | let people = Ppl::find().all(db).await?; |
| 210 | 210 | debug!("DEBUG: Found {} people", people.len()); |
| 211 | 211 | |
| 212 | − for mut person in people { | |
| 212 | + for person in people { | |
| 213 | 213 | // Get all sigdates for this person |
| 214 | 214 | let sigdates = SigDate::find() |
| 215 | 215 | .filter(entities::sig_date::Column::PplId.eq(person.id)) |
Parents: b3afa38