chore: fix clippy warnings for diesel example

This commit is contained in:
Dmitriy Pleshevskiy 2021-11-09 00:49:00 +03:00
parent 2e4d3b6196
commit ca5113f1fb
2 changed files with 3 additions and 2 deletions

View file

@ -4,5 +4,6 @@ use diesel::prelude::*;
pub fn establish_connection() -> PgConnection {
let database_url = config::DATABASE_URL();
PgConnection::establish(database_url).expect(&format!("Error connecting to {}", database_url))
PgConnection::establish(database_url)
.unwrap_or_else(|_| panic!("Error connecting to {}", database_url))
}

View file

@ -23,7 +23,7 @@ fn main() {
println!("Displaying {} posts", posts.len());
for post in posts {
print!("\n");
println!();
println!("{}", post.title);
println!("----------");
println!("{}", post.body);