Avoid using expect when handling Results since it panics if the result type is an Err. To me it seems that it could easily happen in production that the database fails to insert something and using expect would crash the entire code. Therefore, I would change database handling functions such that they return a Result<Something, response::Error>, so we would be able to handle errors dynamically, e.g. retry calling insert.
Furthermore, try to get rid of unwraps (in tests you can keep them), unless you can guarantee that it will never panic. Maybe add a short comment at every unwrap explaining why is it okay to use it there.
Avoid using
expectwhen handlingResults since it panics if the result type is anErr. To me it seems that it could easily happen in production that the database fails to insert something and usingexpectwould crash the entire code. Therefore, I would change database handling functions such that they return a Result<Something, response::Error>, so we would be able to handle errors dynamically, e.g. retry callinginsert.Furthermore, try to get rid of
unwraps (in tests you can keep them), unless you can guarantee that it will never panic. Maybe add a short comment at everyunwrapexplaining why is it okay to use it there.