Enforce consistent semicolons after ()-typed expressions in blocks

This commit is contained in:
Jonas Platte 2022-06-03 08:40:12 +02:00
parent c1737eb20d
commit 73c2963ebd
No known key found for this signature in database
GPG Key ID: AAA7A61F696C3E0C
30 changed files with 70 additions and 64 deletions

View File

@ -28,6 +28,7 @@ rustflags = [
"-Wclippy::needless_borrow", "-Wclippy::needless_borrow",
"-Aclippy::new_without_default", "-Aclippy::new_without_default",
"-Wclippy::nonstandard_macro_braces", "-Wclippy::nonstandard_macro_braces",
"-Wclippy::semicolon_if_nothing_returned",
"-Wclippy::str_to_string", "-Wclippy::str_to_string",
"-Wclippy::todo", "-Wclippy::todo",
"-Wclippy::unreadable_literal", "-Wclippy::unreadable_literal",

View File

@ -47,13 +47,13 @@ mod tests {
#[test] #[test]
fn serialize_filter_events_with_url() { fn serialize_filter_events_with_url() {
let events_with_url = UrlFilter::EventsWithUrl; let events_with_url = UrlFilter::EventsWithUrl;
assert_eq!(to_json_value(events_with_url).unwrap(), json!(true)) assert_eq!(to_json_value(events_with_url).unwrap(), json!(true));
} }
#[test] #[test]
fn serialize_filter_events_without_url() { fn serialize_filter_events_without_url() {
let events_without_url = UrlFilter::EventsWithoutUrl; let events_without_url = UrlFilter::EventsWithoutUrl;
assert_eq!(to_json_value(events_without_url).unwrap(), json!(false)) assert_eq!(to_json_value(events_without_url).unwrap(), json!(false));
} }
#[test] #[test]

View File

@ -667,7 +667,7 @@ pub mod v3 {
assert!(query.contains("since=s72594_4483_1934")); assert!(query.contains("since=s72594_4483_1934"));
assert!(query.contains("full_state=true")); assert!(query.contains("full_state=true"));
assert!(query.contains("set_presence=offline")); assert!(query.contains("set_presence=offline"));
assert!(query.contains("timeout=30000")) assert!(query.contains("timeout=30000"));
} }
} }

View File

@ -209,7 +209,7 @@ impl<'de> Visitor<'de> for RoomNetworkVisitor {
} }
} }
"third_party_instance_id" => { "third_party_instance_id" => {
third_party_instance_id = value.as_str().map(|v| v.to_owned()) third_party_instance_id = value.as_str().map(|v| v.to_owned());
} }
_ => {} _ => {}
}; };

View File

@ -622,7 +622,7 @@ mod tests {
&& sender == "@alice:example.org" && sender == "@alice:example.org"
&& state_key == "@alice:example.org" && state_key == "@alice:example.org"
&& unsigned.is_empty() && unsigned.is_empty()
) );
} }
#[test] #[test]

View File

@ -231,7 +231,7 @@ mod test {
if secret == "org.example.some.secret".into() if secret == "org.example.some.secret".into()
&& requesting_device_id == "ABCDEFG" && requesting_device_id == "ABCDEFG"
&& request_id == "randomly_generated_id_9573" && request_id == "randomly_generated_id_9573"
) );
} }
#[test] #[test]
@ -251,7 +251,7 @@ mod test {
} }
if requesting_device_id.as_str() == "ABCDEFG" if requesting_device_id.as_str() == "ABCDEFG"
&& request_id == "randomly_generated_id_9573" && request_id == "randomly_generated_id_9573"
) );
} }
#[test] #[test]
@ -274,7 +274,7 @@ mod test {
} }
if requesting_device_id == "XYZxyz" if requesting_device_id == "XYZxyz"
&& request_id == "this_is_a_request_id" && request_id == "this_is_a_request_id"
) );
} }
#[test] #[test]
@ -295,6 +295,6 @@ mod test {
if action == RequestAction::_Custom(PrivOwnedStr("my_custom_action".into())) if action == RequestAction::_Custom(PrivOwnedStr("my_custom_action".into()))
&& requesting_device_id == "XYZxyz" && requesting_device_id == "XYZxyz"
&& request_id == "this_is_a_request_id" && request_id == "this_is_a_request_id"
) );
} }
} }

View File

@ -147,7 +147,7 @@ mod tests {
if name == *"my_key" if name == *"my_key"
&& iv == Base64::parse("YWJjZGVmZ2hpamtsbW5vcA").unwrap() && iv == Base64::parse("YWJjZGVmZ2hpamtsbW5vcA").unwrap()
&& mac == Base64::parse("aWRvbnRrbm93d2hhdGFtYWNsb29rc2xpa2U").unwrap() && mac == Base64::parse("aWRvbnRrbm93d2hhdGFtYWNsb29rc2xpa2U").unwrap()
) );
} }
#[test] #[test]
@ -216,7 +216,7 @@ mod tests {
&& salt == *"rocksalt" && salt == *"rocksalt"
&& iterations == uint!(8) && iterations == uint!(8)
&& bits == uint!(256) && bits == uint!(256)
) );
} }
#[test] #[test]
@ -274,6 +274,6 @@ mod tests {
&& name == *"my_key" && name == *"my_key"
&& iv == Base64::parse("YWJjZGVmZ2hpamtsbW5vcA").unwrap() && iv == Base64::parse("YWJjZGVmZ2hpamtsbW5vcA").unwrap()
&& mac == Base64::parse("aWRvbnRrbm93d2hhdGFtYWNsb29rc2xpa2U").unwrap() && mac == Base64::parse("aWRvbnRrbm93d2hhdGFtYWNsb29rc2xpa2U").unwrap()
) );
} }
} }

View File

@ -102,7 +102,7 @@ mod tests {
if iv == &Base64::parse("YWJjZGVmZ2hpamtsbW5vcA").unwrap() if iv == &Base64::parse("YWJjZGVmZ2hpamtsbW5vcA").unwrap()
&& ciphertext == &Base64::parse("dGhpc2lzZGVmaW5pdGVseWNpcGhlcnRleHQ").unwrap() && ciphertext == &Base64::parse("dGhpc2lzZGVmaW5pdGVseWNpcGhlcnRleHQ").unwrap()
&& mac == &Base64::parse("aWRvbnRrbm93d2hhdGFtYWNsb29rc2xpa2U").unwrap() && mac == &Base64::parse("aWRvbnRrbm93d2hhdGFtYWNsb29rc2xpa2U").unwrap()
) );
} }
} }
} }

View File

@ -34,6 +34,6 @@ mod tests {
#[test] #[test]
fn valid_secret() { fn valid_secret() {
assert!(<&ClientSecret>::try_from("this_=_a_valid_secret_1337").is_ok()) assert!(<&ClientSecret>::try_from("this_=_a_valid_secret_1337").is_ok());
} }
} }

View File

@ -94,7 +94,7 @@ mod tests {
<&EventId>::try_from("$acR1l0raoZnm60CBwAVgqbZqoO/mYU81xysh1u7XcJk") <&EventId>::try_from("$acR1l0raoZnm60CBwAVgqbZqoO/mYU81xysh1u7XcJk")
.expect("Failed to create EventId."), .expect("Failed to create EventId."),
"$acR1l0raoZnm60CBwAVgqbZqoO/mYU81xysh1u7XcJk" "$acR1l0raoZnm60CBwAVgqbZqoO/mYU81xysh1u7XcJk"
) );
} }
#[test] #[test]
@ -103,7 +103,7 @@ mod tests {
<&EventId>::try_from("$Rqnc-F-dvnEYJTyHq_iKxU2bZ1CI92-kuZq3a5lr5Zg") <&EventId>::try_from("$Rqnc-F-dvnEYJTyHq_iKxU2bZ1CI92-kuZq3a5lr5Zg")
.expect("Failed to create EventId."), .expect("Failed to create EventId."),
"$Rqnc-F-dvnEYJTyHq_iKxU2bZ1CI92-kuZq3a5lr5Zg" "$Rqnc-F-dvnEYJTyHq_iKxU2bZ1CI92-kuZq3a5lr5Zg"
) );
} }
#[cfg(feature = "rand")] #[cfg(feature = "rand")]

View File

@ -738,7 +738,7 @@ mod tests {
) )
.unwrap_err(), .unwrap_err(),
MatrixToError::UnknownArgument.into() MatrixToError::UnknownArgument.into()
) );
} }
#[test] #[test]

View File

@ -33,6 +33,6 @@ mod tests {
#[test] #[test]
fn try_from() { fn try_from() {
assert!(<&VoipId>::try_from("this_-_a_valid_secret_1337").is_ok()) assert!(<&VoipId>::try_from("this_-_a_valid_secret_1337").is_ok());
} }
} }

View File

@ -93,7 +93,7 @@ mod tests {
assert_eq!( assert_eq!(
to_json_string(&json).unwrap(), to_json_string(&json).unwrap(),
r#"{"auth":{"mxid":"@john.doe:example.com","profile":{"display_name":"John Doe","three_pids":[{"address":"john.doe@example.org","medium":"email"},{"address":"123456789","medium":"msisdn"}]},"success":true}}"# r#"{"auth":{"mxid":"@john.doe:example.com","profile":{"display_name":"John Doe","three_pids":[{"address":"john.doe@example.org","medium":"email"},{"address":"123456789","medium":"msisdn"}]},"success":true}}"#
) );
} }
#[test] #[test]

View File

@ -30,7 +30,7 @@ impl<T> ValOrVec<T> {
let existing_val = ptr::read(val); let existing_val = ptr::read(val);
vec.push(existing_val); vec.push(existing_val);
vec.push(new_val); vec.push(new_val);
ptr::write(self, ValOrVec::Vec(vec)) ptr::write(self, ValOrVec::Vec(vec));
} }
} }
ValOrVec::Vec(vec) => vec.push(new_val), ValOrVec::Vec(vec) => vec.push(new_val),

View File

@ -468,7 +468,7 @@ fn negotiate_event_deserialization() {
assert_eq!(content.party_id, "9876"); assert_eq!(content.party_id, "9876");
assert_eq!(content.lifetime, uint!(30000)); assert_eq!(content.lifetime, uint!(30000));
assert_eq!(content.description.session_type, SessionDescriptionType::PrAnswer); assert_eq!(content.description.session_type, SessionDescriptionType::PrAnswer);
assert_eq!(content.description.sdp, "not a real sdp") assert_eq!(content.description.sdp, "not a real sdp");
} }
#[test] #[test]

View File

@ -131,7 +131,7 @@ fn redacted_aliases_deserialize() {
}), }),
)) if event_id == event_id!("$h29iv0s8:example.com") )) if event_id == event_id!("$h29iv0s8:example.com")
&& aliases.is_none() && aliases.is_none()
) );
} }
#[test] #[test]
@ -156,7 +156,7 @@ fn redacted_deserialize_any_room() {
}), }),
)) if event_id == event_id!("$h29iv0s8:example.com") )) if event_id == event_id!("$h29iv0s8:example.com")
&& room_id == room_id!("!roomid:room.com") && room_id == room_id!("!roomid:room.com")
) );
} }
#[test] #[test]
@ -194,7 +194,7 @@ fn redacted_deserialize_any_room_sync() {
.. ..
}), }),
)) if event_id == event_id!("$h29iv0s8:example.com") )) if event_id == event_id!("$h29iv0s8:example.com")
) );
} }
#[test] #[test]
@ -226,7 +226,7 @@ fn redacted_state_event_deserialize() {
)) if event_id == event_id!("$h29iv0s8:example.com") )) if event_id == event_id!("$h29iv0s8:example.com")
&& unsigned.redacted_because.is_some() && unsigned.redacted_because.is_some()
&& creator == user_id!("@carl:example.com") && creator == user_id!("@carl:example.com")
) );
} }
#[test] #[test]
@ -246,7 +246,7 @@ fn redacted_custom_event_serialize() {
); );
let x = from_json_value::<AnySyncStateEvent>(redacted).unwrap(); let x = from_json_value::<AnySyncStateEvent>(redacted).unwrap();
assert_eq!(x.event_id(), event_id!("$h29iv0s8:example.com")) assert_eq!(x.event_id(), event_id!("$h29iv0s8:example.com"));
} }
/* #[test] /* #[test]

View File

@ -100,7 +100,7 @@ fn deserialize_list_of_str() {
Err(error) if error.to_string().contains("unsupported") Err(error) if error.to_string().contains("unsupported")
); );
assert_eq!(urlencoded::from_str("a=a&a=b"), Ok(vec![("a", vec!["a", "b"])])) assert_eq!(urlencoded::from_str("a=a&a=b"), Ok(vec![("a", vec!["a", "b"])]));
} }
#[test] #[test]

View File

@ -92,7 +92,7 @@ fn serialize_nested_list() {
assert_matches!( assert_matches!(
urlencoded::to_string(params), urlencoded::to_string(params),
Err(Error::Custom(s)) if s.contains("unsupported") Err(Error::Custom(s)) if s.contains("unsupported")
) );
} }
#[test] #[test]

View File

@ -329,6 +329,6 @@ impl Parse for EndpointPath {
impl ToTokens for EndpointPath { impl ToTokens for EndpointPath {
fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) { fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {
self.0.to_tokens(tokens) self.0.to_tokens(tokens);
} }
} }

View File

@ -489,6 +489,6 @@ impl Parse for RequestField {
impl ToTokens for RequestField { impl ToTokens for RequestField {
fn to_tokens(&self, tokens: &mut TokenStream) { fn to_tokens(&self, tokens: &mut TokenStream) {
self.field().to_tokens(tokens) self.field().to_tokens(tokens);
} }
} }

View File

@ -256,7 +256,7 @@ impl Parse for ResponseField {
impl ToTokens for ResponseField { impl ToTokens for ResponseField {
fn to_tokens(&self, tokens: &mut TokenStream) { fn to_tokens(&self, tokens: &mut TokenStream) {
self.field().to_tokens(tokens) self.field().to_tokens(tokens);
} }
} }

View File

@ -25,7 +25,7 @@ pub fn collect_lifetime_idents(lifetimes: &mut BTreeSet<Lifetime>, ty: &Type) {
} }
} }
Visitor(lifetimes).visit_type(ty) Visitor(lifetimes).visit_type(ty);
} }
pub fn all_cfgs_expr(cfgs: &[Attribute]) -> Option<TokenStream> { pub fn all_cfgs_expr(cfgs: &[Attribute]) -> Option<TokenStream> {

View File

@ -658,7 +658,7 @@ impl EventEnumVariant {
} }
} }
if let Some(p) = prefix { if let Some(p) = prefix {
tokens.extend(quote! { #p :: }) tokens.extend(quote! { #p :: });
} }
self.ident.to_tokens(&mut tokens); self.ident.to_tokens(&mut tokens);

View File

@ -256,7 +256,7 @@ impl Parse for EventEnumEntry {
let alias = alias_attr.into_inner(); let alias = alias_attr.into_inner();
if alias.value().ends_with(".*") == has_suffix { if alias.value().ends_with(".*") == has_suffix {
aliases.push(alias) aliases.push(alias);
} else { } else {
return Err(syn::Error::new_spanned( return Err(syn::Error::new_spanned(
&attr_list, &attr_list,

View File

@ -160,10 +160,10 @@ fn generate_enum(
_s if _s.starts_with(#prefix) => { _s if _s.starts_with(#prefix) => {
#ctor(::std::convert::From::from(_s.strip_prefix(#prefix).unwrap())) #ctor(::std::convert::From::from(_s.strip_prefix(#prefix).unwrap()))
} }
}) });
} }
} else { } else {
from_str_match_arms.extend(quote! { #(#attrs)* #(#ev_types)|* => #ctor, }) from_str_match_arms.extend(quote! { #(#attrs)* #(#ev_types)|* => #ctor, });
} }
} }

View File

@ -453,7 +453,7 @@ pub mod v1 {
..Notification::default() ..Notification::default()
}; };
assert_eq!(expected, to_json_value(notice).unwrap()) assert_eq!(expected, to_json_value(notice).unwrap());
} }
} }
} }

View File

@ -783,7 +783,7 @@ pub fn redact_content_in_place(
version: &RoomVersionId, version: &RoomVersionId,
event_type: impl AsRef<str>, event_type: impl AsRef<str>,
) { ) {
object_retain_keys(object, allowed_content_keys_for(event_type.as_ref(), version)) object_retain_keys(object, allowed_content_keys_for(event_type.as_ref(), version));
} }
fn object_retain_keys(object: &mut CanonicalJsonObject, keys: &[&str]) { fn object_retain_keys(object: &mut CanonicalJsonObject, keys: &[&str]) {
@ -1065,8 +1065,8 @@ mod tests {
let verification_result = verify_event(&public_key_map, &signed_event, &RoomVersionId::V9); let verification_result = verify_event(&public_key_map, &signed_event, &RoomVersionId::V9);
assert!(verification_result.is_err()) // Should be Err(VerificationError:: // Should be Err(VerificationError::signature_not_found("domain-authorized")));
// signature_not_found("domain-authorized"))); assert!(verification_result.is_err());
} }
#[test] #[test]
@ -1152,7 +1152,9 @@ mod tests {
if let Error::Verification(VerificationError::Signature(error)) = error_msg { if let Error::Verification(VerificationError::Signature(error)) = error_msg {
// dalek doesn't expose InternalError :( // dalek doesn't expose InternalError :(
// https://github.com/dalek-cryptography/ed25519-dalek/issues/174 // https://github.com/dalek-cryptography/ed25519-dalek/issues/174
assert!(format!("{:?}", error).contains("Some(Verification equation was not satisfied)")) assert!(
format!("{:?}", error).contains("Some(Verification equation was not satisfied)")
);
} else { } else {
panic!("Error was not VerificationError::Signature: {:?}", error_msg); panic!("Error was not VerificationError::Signature: {:?}", error_msg);
}; };

View File

@ -53,7 +53,7 @@ fn lexico_topo_sort(c: &mut Criterion) {
let _ = state_res::lexicographical_topological_sort(&graph, |_id| { let _ = state_res::lexicographical_topological_sort(&graph, |_id| {
Ok((int!(0), MilliSecondsSinceUnixEpoch(uint!(0)))) Ok((int!(0), MilliSecondsSinceUnixEpoch(uint!(0))))
}); });
}) });
}); });
} }
@ -81,7 +81,7 @@ fn resolution_shallow_auth_chain(c: &mut Criterion) {
Ok(state) => state, Ok(state) => state,
Err(e) => panic!("{}", e), Err(e) => panic!("{}", e),
}; };
}) });
}); });
} }
@ -139,7 +139,7 @@ fn resolve_deeper_event_set(c: &mut Criterion) {
Ok(state) => state, Ok(state) => state,
Err(_) => panic!("resolution failed during benchmarking"), Err(_) => panic!("resolution failed during benchmarking"),
}; };
}) });
}); });
} }

View File

@ -738,7 +738,7 @@ mod tests {
"$END:foo" "$END:foo"
], ],
sorted_event_ids.iter().map(|id| id.to_string()).collect::<Vec<_>>() sorted_event_ids.iter().map(|id| id.to_string()).collect::<Vec<_>>()
) );
} }
#[test] #[test]
@ -746,7 +746,7 @@ mod tests {
for _ in 0..20 { for _ in 0..20 {
// since we shuffle the eventIds before we sort them introducing randomness // since we shuffle the eventIds before we sort them introducing randomness
// seems like we should test this a few times // seems like we should test this a few times
test_event_sort() test_event_sort();
} }
} }
@ -794,7 +794,7 @@ mod tests {
let expected_state_ids = let expected_state_ids =
vec!["PA", "MA", "MB"].into_iter().map(event_id).collect::<Vec<_>>(); vec!["PA", "MA", "MB"].into_iter().map(event_id).collect::<Vec<_>>();
do_check(events, edges, expected_state_ids) do_check(events, edges, expected_state_ids);
} }
#[test] #[test]
@ -855,7 +855,7 @@ mod tests {
let expected_state_ids = vec!["PA2", "T2"].into_iter().map(event_id).collect::<Vec<_>>(); let expected_state_ids = vec!["PA2", "T2"].into_iter().map(event_id).collect::<Vec<_>>();
do_check(events, edges, expected_state_ids) do_check(events, edges, expected_state_ids);
} }
#[test] #[test]
@ -902,7 +902,7 @@ mod tests {
let expected_state_ids = let expected_state_ids =
vec!["T1", "MB", "PA"].into_iter().map(event_id).collect::<Vec<_>>(); vec!["T1", "MB", "PA"].into_iter().map(event_id).collect::<Vec<_>>();
do_check(events, edges, expected_state_ids) do_check(events, edges, expected_state_ids);
} }
#[test] #[test]
@ -934,7 +934,7 @@ mod tests {
let expected_state_ids = vec![event_id("JR")]; let expected_state_ids = vec![event_id("JR")];
do_check(events, edges, expected_state_ids) do_check(events, edges, expected_state_ids);
} }
#[test] #[test]
@ -975,7 +975,7 @@ mod tests {
let expected_state_ids = vec!["PC"].into_iter().map(event_id).collect::<Vec<_>>(); let expected_state_ids = vec!["PC"].into_iter().map(event_id).collect::<Vec<_>>();
do_check(events, edges, expected_state_ids) do_check(events, edges, expected_state_ids);
} }
#[test] #[test]
@ -1052,7 +1052,7 @@ mod tests {
let expected_state_ids = vec!["T4", "PA2"].into_iter().map(event_id).collect::<Vec<_>>(); let expected_state_ids = vec!["T4", "PA2"].into_iter().map(event_id).collect::<Vec<_>>();
do_check(events, edges, expected_state_ids) do_check(events, edges, expected_state_ids);
} }
#[test] #[test]
@ -1082,7 +1082,7 @@ mod tests {
Err(e) => panic!("{}", e), Err(e) => panic!("{}", e),
}; };
assert_eq!(expected, resolved) assert_eq!(expected, resolved);
} }
#[test] #[test]
@ -1109,7 +1109,7 @@ mod tests {
.map(ToString::to_string) .map(ToString::to_string)
.map(|s| s.replace('$', "").replace(":foo", "")) .map(|s| s.replace('$', "").replace(":foo", ""))
.collect::<Vec<_>>() .collect::<Vec<_>>()
) );
} }
#[test] #[test]
@ -1202,9 +1202,9 @@ mod tests {
for id in expected.iter().map(|i| event_id(i)) { for id in expected.iter().map(|i| event_id(i)) {
// make sure our resolved events are equal to the expected list // make sure our resolved events are equal to the expected list
assert!(resolved.values().any(|eid| eid == &id) || init.contains_key(&id), "{}", id) assert!(resolved.values().any(|eid| eid == &id) || init.contains_key(&id), "{}", id);
} }
assert_eq!(expected.len(), resolved.len()) assert_eq!(expected.len(), resolved.len());
} }
#[test] #[test]

View File

@ -50,7 +50,11 @@ async fn run() -> Result<(), Box<dyn Error>> {
}) })
.await .await
{ {
eprintln!("Failed to persist access token to disk. Re-authentication will be required on the next startup: {}", err) eprintln!(
"Failed to persist access token to disk. \
Re-authentication will be required on the next startup: {}",
err
);
} }
client client
} else { } else {
@ -91,14 +95,14 @@ async fn run() -> Result<(), Box<dyn Error>> {
if let Err(err) = if let Err(err) =
handle_message(http_client, matrix_client, e, room_id, user_id).await handle_message(http_client, matrix_client, e, room_id, user_id).await
{ {
eprintln!("failed to respond to message: {}", err) eprintln!("failed to respond to message: {}", err);
} }
} }
}); });
let invite_futures = response.rooms.invite.iter().map(|(room_id, _)| async move { let invite_futures = response.rooms.invite.iter().map(|(room_id, _)| async move {
if let Err(err) = handle_invitations(http_client, matrix_client, room_id).await { if let Err(err) = handle_invitations(http_client, matrix_client, room_id).await {
eprintln!("failed to accept invitation for room {}: {}", &room_id, err) eprintln!("failed to accept invitation for room {}: {}", &room_id, err);
} }
}); });
@ -240,10 +244,9 @@ async fn read_config() -> io::Result<Config> {
"homeserver" => homeserver = Some(value.trim().to_owned()), "homeserver" => homeserver = Some(value.trim().to_owned()),
// TODO: infer domain from `homeserver` // TODO: infer domain from `homeserver`
"username" => { "username" => {
username = username = value.trim().to_owned().try_into().map_err(|e| {
value.trim().to_owned().try_into().map_err(|e| { format!("invalid Matrix user ID format for `username`: {}", e)
format!("invalid Matrix user ID format for `username`: {}", e) });
})
} }
"password" => password = Some(value.trim().to_owned()), "password" => password = Some(value.trim().to_owned()),
_ => {} _ => {}
@ -256,7 +259,7 @@ async fn read_config() -> io::Result<Config> {
(homeserver, username) => { (homeserver, username) => {
let mut error = String::from("Invalid config specified:"); let mut error = String::from("Invalid config specified:");
if homeserver.is_none() { if homeserver.is_none() {
error.push_str("\n required field `homeserver` is missing") error.push_str("\n required field `homeserver` is missing");
} }
if let Err(e) = username { if let Err(e) = username {
error.push_str("\n "); error.push_str("\n ");