chiark / gitweb /
Remove lots of commas after braced match arms.
authorSimon Tatham <anakin@pobox.com>
Mon, 1 Jan 2024 13:50:00 +0000 (13:50 +0000)
committerSimon Tatham <anakin@pobox.com>
Mon, 1 Jan 2024 13:50:00 +0000 (13:50 +0000)
I only just noticed from reading someone else's Rust code that they
aren't syntactically necessary!

src/activity_stack.rs
src/auth.rs
src/client.rs
src/coloured_string.rs
src/config.rs
src/editor.rs
src/file.rs
src/html.rs
src/scan_re.rs
src/text.rs
src/tui.rs

index fff8f47062678a34eca710c4758d83c4c017fd57..77bc55128e37a02b5317d75a530bce85460bd951 100644 (file)
@@ -104,7 +104,7 @@ impl ActivityStack {
             Activity::Util(x) => {
                 self.overlay = None;
                 self.util = Some(x);
-            },
+            }
             Activity::NonUtil(x) => {
                 self.util = None;
                 self.overlay = None;
@@ -118,13 +118,13 @@ impl ActivityStack {
                         };
                         self.nonutil.truncate(trunc);
                         self.nonutil.push(y);
-                    },
+                    }
                 }
-            },
+            }
             Activity::Overlay(x) => {
                 self.util = self.initial_util.clone();
                 self.overlay = Some(x);
-            },
+            }
         }
     }
 
@@ -134,7 +134,7 @@ impl ActivityStack {
             _ => match self.nonutil.last() {
                 Some(y) => Activity::NonUtil(y.clone()),
                 _ => Activity::NonUtil(NonUtilityActivity::MainMenu),
-            },
+            }
         }
     }
 
index 098db84ca4d75fd4748add574bee255fd642c210..ce195d9d13ba5a14d689785432b4e747b23de152 100644 (file)
@@ -15,10 +15,10 @@ impl std::fmt::Display for AuthError {
         match self {
             AuthError::Nonexistent(_) => {
                 write!(f, "not logged in")
-            },
+            }
             AuthError::Bad(ref msg) => {
                 write!(f, "unable to read authentication: {}", msg)
-            },
+            }
         }
     }
 }
index ddc445307f85529ca178281e9329b94544ad91dd..3a732a08e3204b62d7db0423b81abc8a724fba54 100644 (file)
@@ -301,7 +301,7 @@ impl Client {
                 Ok(st) => Ok(st),
                 Err(e) => {
                     Err(ClientError::UrlError(url.clone(), e.to_string()))
-                },
+                }
             }
         }?;
         if st.id != id {
@@ -346,7 +346,7 @@ impl Client {
                 Ok(st) => Ok(st),
                 Err(e) => {
                     Err(ClientError::UrlError(url.clone(), e.to_string()))
-                },
+                }
             }
         }?;
         if not.id != id {
@@ -391,27 +391,27 @@ impl Client {
             FeedId::Home => Req::get("timelines/home"),
             FeedId::Local => {
                 Req::get("timelines/public").param("local", true)
-            },
+            }
             FeedId::Public => {
                 Req::get("timelines/public").param("local", false)
-            },
+            }
             FeedId::Hashtag(ref tag) => {
                 Req::get(&format!("timelines/tag/{}", &tag))
-            },
+            }
             FeedId::User(id, boosts, replies) => {
                 Req::get(&format!("accounts/{}/statuses", id))
                     .param("exclude_reblogs", *boosts == Boosts::Hide)
                     .param("exclude_replies", *replies == Replies::Hide)
-            },
+            }
             FeedId::Mentions => {
                 Req::get("notifications").param("types[]", "mention")
-            },
+            }
             FeedId::Ego => {
                 Req::get("notifications")
                     .param("types[]", "reblog")
                     .param("types[]", "follow")
                     .param("types[]", "favourite")
-            },
+            }
         };
 
         let req = match ext {
@@ -449,20 +449,20 @@ impl Client {
                     Ok(sts) => Ok(sts),
                     Err(e) => {
                         Err(ClientError::UrlError(url.clone(), e.to_string()))
-                    },
+                    }
                 }?;
                 for st in &sts {
                     self.cache_status(st);
                 }
                 sts.iter().rev().map(|st| st.id.clone()).collect()
-            },
+            }
             FeedId::Mentions | FeedId::Ego => {
                 let mut nots: Vec<Notification> = match serde_json::from_str(
                     &body) {
                     Ok(nots) => Ok(nots),
                     Err(e) => {
                         Err(ClientError::UrlError(url.clone(), e.to_string()))
-                    },
+                    }
                 }?;
 
                 match id {
@@ -476,21 +476,21 @@ impl Client {
                             not.ntype == NotificationType::Mention &&
                                 not.status.is_some()
                         });
-                    },
+                    }
                     FeedId::Ego => {
                         nots.retain(|not| {
                             not.ntype == NotificationType::Reblog ||
                                 not.ntype == NotificationType::Follow ||
                                 not.ntype == NotificationType::Favourite
                         });
-                    },
+                    }
                     _ => panic!("outer match passed us {:?}", id),
                 }
                 for not in &nots {
                     self.cache_notification(not);
                 }
                 nots.iter().rev().map(|not| not.id.clone()).collect()
-            },
+            }
         };
         let any_new = !ids.is_empty();
 
@@ -500,20 +500,20 @@ impl Client {
                     ids: ids,
                     origin: 0,
                 });
-            },
+            }
             FeedExtend::Future => {
                 let feed = self.feeds.get_mut(id).unwrap();
                 for id in ids.iter() {
                     feed.ids.push_back(id.to_string());
                 }
-            },
+            }
             FeedExtend::Past => {
                 let feed = self.feeds.get_mut(id).unwrap();
                 for id in ids.iter().rev() {
                     feed.ids.push_front(id.to_string());
                     feed.origin -= 1;
                 }
-            },
+            }
         }
 
         Ok(any_new)
@@ -604,7 +604,7 @@ impl Client {
                         updates.insert(id.clone());
                     }
                 }
-            },
+            }
 
             // FIXME: we probably _should_ handle EOF from the
             // subthread, though I'm not quite sure how yet. Stream
index cb3a7e142f9f823105fe75497a49b5a862a1b283..72d3b31411bfad4c2ef7d6ad100e9517f3c8e7f8 100644 (file)
@@ -300,7 +300,7 @@ impl<'a> Iterator for ColouredStringSplitIterator<'a> {
                 } else {
                     None
                 }
-            },
+            }
             (Some((_, tc)), Some(_)) => {
                 let mut tpos: usize = 0;
                 let mut cpos: usize = 0;
@@ -315,12 +315,12 @@ impl<'a> Iterator for ColouredStringSplitIterator<'a> {
                     match (textit.next(), colourit.next()) {
                         (None, None) => {
                             break (textslice.len(), colourslice.len());
-                        },
+                        }
                         (Some((ti, tc)), Some((ci, _))) => {
                             tpos = ti;
                             cpos = ci;
                             last_tc = tc;
-                        },
+                        }
                         _ => panic!("length mismatch in CSSI"),
                     };
                 };
@@ -330,7 +330,7 @@ impl<'a> Iterator for ColouredStringSplitIterator<'a> {
                         text: &textslice[..textend],
                         colour: &colourslice[..colourend],
                     })
-            },
+            }
             _ => panic!("length mismatch in CSSI"),
         }
     }
index e6c50103c75ff5152af3ef098f27743e3029dec9..630846877963c29f14eafe35f7d700a55563b91e 100644 (file)
@@ -18,14 +18,14 @@ impl std::fmt::Display for ConfigError {
     {
         match self {
             #[cfg(unix)]
-            ConfigError::XDG(e) => { e.fmt(f) },
+            ConfigError::XDG(e) => { e.fmt(f) }
 
             #[cfg(windows)]
             ConfigError::Env(e) => {
                 // FIXME: how _should_ we include the information
                 // about what environment variable?
                 write!(f, "%APPDATA%: {}", e)
-            },
+            }
         }
     }
 }
index 8f5c9eddbf99c3f870b0508442971c70e32ece98..65178e0e3296046791d683719dda2bd8287a40e0 100644 (file)
@@ -38,7 +38,7 @@ impl EditorCore {
                     end += 1;
                 }
                 Some((width, end - pos))
-            },
+            }
         }
     }
 
@@ -322,7 +322,7 @@ impl SingleLineEditor {
                         Some((w, b)) => {
                             head += b;
                             currwidth += w;
-                        },
+                        }
                     }
                 } else {
                     match self.core.char_width_and_bytes(tail) {
@@ -334,7 +334,7 @@ impl SingleLineEditor {
                                 counted_initial_trunc_marker = true;
                                 avail_width = avail_width.saturating_sub(1);
                             }
-                        },
+                        }
                     }
                 }
             }
index 1f244bba181e4c449d45b2fbc55f96cc1e54e052..e5276aa23e4dca8d271acf595fd79c35fba9ee28 100644 (file)
@@ -290,7 +290,7 @@ impl<Type: FileType, Source: FileDataSource> File<Type, Source> {
         match &mut self.contents.extender {
             Some(ref mut ext) => {
                 ext.set_primed(at_top);
-            },
+            }
             _ => (),
         };
         if let Some(ei) = self.contents.extender_index() {
@@ -498,15 +498,15 @@ impl<Type: FileType, Source: FileDataSource>
             Up => {
                 self.move_up(1);
                 LogicalAction::Nothing
-            },
+            }
             Pr('-') | Pr('b') | Pr('B') | PgUp | Left => {
                 self.move_up(max(1, h - min(h, 3)));
                 LogicalAction::Nothing
-            },
+            }
             Down => {
                 self.move_down(1);
                 LogicalAction::Nothing
-            },
+            }
             Return => {
                 let oldpos = self.pos;
                 self.move_down(1);
@@ -515,11 +515,11 @@ impl<Type: FileType, Source: FileDataSource>
                 } else {
                     LogicalAction::Nothing
                 }
-            },
+            }
             Space | PgDn | Right => {
                 self.move_down(max(1, h - min(h, 3)));
                 LogicalAction::Nothing
-            },
+            }
             Pr('0') | Home => {
                 if self.at_top() && self.contents.extender.is_some() {
                     let action = match self.contents.source.try_extend(client) {
@@ -546,7 +546,7 @@ impl<Type: FileType, Source: FileDataSource>
 
                             self.contents.update_items(client);
                             LogicalAction::Nothing
-                        },
+                        }
                         Err(e) => LogicalAction::Error(e),
                     };
                     self.ensure_enough_rendered();
index b470ad84acd7a11d213c43ac7616212e05725c2a..73cb40a560dda4fdab8984be559c5b27f2c661ea 100644 (file)
@@ -173,7 +173,7 @@ fn to_coloured_string(tl: &TaggedLine<Vec<char>>) -> ColouredString {
                     None => ' ',
                 };
                 cs.push_str(&ColouredString::uniform(&ts.s, c).slice());
-            },
+            }
             _ => (),
         }
     }
index b115e74f1f368bd67b6e89681d437dcfa9547c15..304d52c1549fcdaccc4bc9fa815cd4d80d92cb10 100644 (file)
@@ -21,7 +21,7 @@ impl Findable {
                         None => break Some((ms, me)),
                         Some(_) => start = ms + 1,
                     }
-                },
+                }
             };
         }
     }
index 2bc84362fd795e9fae4740e4a99dca681ddee7ee..3388f26cd48696de547318c83e85883da5fcd9d5 100644 (file)
@@ -81,7 +81,7 @@ impl TextFragment for SeparatorLine {
                 suffix = &display_pre +
                     ColouredString::uniform(&datestr, 'D') +
                     &display_post + suffix;
-            },
+            }
             _ => (),
         }
         if self.boosted {
@@ -591,7 +591,7 @@ impl TextFragment for Html {
             Html::Rt(ref rt) => html::render(rt, width - min(width, 1)),
             Html::Bad(e) => vec! {
                 ColouredString::uniform(e, '!'),
-            },
+            }
         }
     }
 }
@@ -939,7 +939,7 @@ impl Media {
                     .collect();
                 trim_para_list(&mut paras);
                 paras
-            },
+            }
         };
 
         Media {
@@ -1421,7 +1421,7 @@ impl StatusDisplay {
                     )),
                 };
                 Some(InReplyToLine::new(parent_text))
-            },
+            }
         };
 
         let content = Html::new(&st.content);
index 0cad0609a3eae20dc1da8b07388caaa3386929ab..32a580d34bd61adb927344b61c026413d6240f56 100644 (file)
@@ -268,7 +268,7 @@ impl Tui {
                     Some(OurKey::Pr(' ')) => Some(OurKey::Space),
                     other => other,
                 }
-            },
+            }
             _ => None,
         };
         if let Some(main) = main {
@@ -327,24 +327,24 @@ impl Tui {
                                         ourkey, &mut self.client) {
                                         PhysicalAction::Beep => {
                                             Self::beep()?
-                                        },
+                                        }
 
                                         PhysicalAction::Exit => {
                                             break 'outer Ok(());
-                                        },
+                                        }
 
                                         PhysicalAction::Error(err) => {
                                             break 'outer Err(err);
-                                        },
+                                        }
 
                                         PhysicalAction::Nothing => (),
                                     }
                                 }
                             }
-                        },
+                        }
                         _ => (),
                     }
-                },
+                }
                 Ok(SubthreadEvent::StreamEv(update)) => {
                     match self.client.process_stream_update(update) {
                         Ok(feeds_updated) => {
@@ -352,19 +352,19 @@ impl Tui {
                                                             &mut self.client) {
                                 PhysicalAction::Beep => {
                                     Self::beep()?
-                                },
+                                }
 
                                 PhysicalAction::Exit => {
                                     break 'outer Ok(());
-                                },
+                                }
 
                                 PhysicalAction::Error(err) => {
                                     break 'outer Err(err);
-                                },
+                                }
 
                                 PhysicalAction::Nothing => (),
                             }
-                        },
+                        }
 
                         // FIXME: errors here should go in the Error Log
                         _ => (),
@@ -562,20 +562,20 @@ impl TuiLogicalState {
                 self.activity_stack.goto(activity);
                 self.changed_activity(client);
                 PhysicalAction::Nothing
-            },
+            }
             LogicalAction::Pop => {
                 self.activity_stack.pop();
                 self.changed_activity(client);
                 PhysicalAction::Nothing
-            },
+            }
             LogicalAction::PopOverlaySilent => {
                 self.pop_overlay_activity();
                 PhysicalAction::Nothing
-            },
+            }
             LogicalAction::PopOverlayBeep => {
                 self.pop_overlay_activity();
                 PhysicalAction::Beep
-            },
+            }
             LogicalAction::Error(_) => PhysicalAction::Beep, // FIXME: Error Log
         }
     }