fix clippy warnings

This commit is contained in:
Ayrat Badykov 2021-06-23 14:30:19 +03:00
parent 1f00098687
commit b92af896d4
No known key found for this signature in database
GPG key ID: 16AE533AB7A3E8C6
3 changed files with 4 additions and 9 deletions

View file

@ -85,7 +85,7 @@ impl Executor {
pub fn sleep(&mut self) {
if self.sleep_period < self.max_sleep_period {
self.sleep_period = self.sleep_period + self.sleep_step;
self.sleep_period += self.sleep_step;
}
thread::sleep(Duration::from_secs(self.sleep_period));

View file

@ -37,15 +37,11 @@ impl Postgres {
let url = match database_url {
Some(string_url) => string_url,
None => {
let url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
url
}
None => env::var("DATABASE_URL").expect("DATABASE_URL must be set"),
};
let connection =
PgConnection::establish(&url).expect(&format!("Error connecting to {}", url));
PgConnection::establish(&url).unwrap_or_else(|_| panic!("Error connecting to {}", url));
Self {
connection,
@ -85,7 +81,7 @@ impl Postgres {
self.connection.transaction::<Option<Task>, Error, _>(|| {
let found_task = self.fetch_task();
if let None = found_task {
if found_task.is_none() {
return Ok(None);
}

View file

@ -36,7 +36,6 @@ impl WorkerThread {
pub fn spawn_in_pool(name: String, restarts: u64) {
let mut builder = thread::Builder::new().name(name.clone());
builder = builder;
info!(
"starting a worker thread {}, number of restarts {}",