reformat, add ping command

This commit is contained in:
2021-08-22 19:30:36 +02:00
parent 448746b1da
commit 0403d1ef71
7 changed files with 108 additions and 237 deletions
+2 -8
View File
@@ -22,10 +22,7 @@ pub(crate) fn acct_to_server(acct: &str) -> Option<&str> {
acct.trim_start_matches('@').split('@').nth(1)
}
pub(crate) fn normalize_acct<'a, 'g>(
acct: &'a str,
group: &'g str,
) -> Result<Cow<'a, str>, GroupError> {
pub(crate) fn normalize_acct<'a, 'g>(acct: &'a str, group: &'g str) -> Result<Cow<'a, str>, GroupError> {
let acct = acct.trim_start_matches('@');
if acct_to_server(acct).is_some() {
// already has server
@@ -82,9 +79,6 @@ mod test {
Ok("piggo@piggo.space".into()),
normalize_acct("piggo@piggo.space", "uhh")
);
assert_eq!(
Err(GroupError::BadConfig("_".into())),
normalize_acct("piggo", "uhh")
);
assert_eq!(Err(GroupError::BadConfig("_".into())), normalize_acct("piggo", "uhh"));
}
}