Skip to content

Commit 052f7ca

Browse files
committed
more clippy and adding toolchain file
1 parent fbba8d4 commit 052f7ca

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

rust-toolchain.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[toolchain]
2+
channel = "nightly-2021-05-11"
3+
components = [ "rustfmt", "clippy" ]
4+
profile = "minimal"

src/db/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub type PgPool = Pool<ConnectionManager<PgConnection>>;
2121

2222
pub fn get_single_connection() -> PgConnection {
2323
PgConnection::establish(&database_url())
24-
.expect(&format!("Error connecting to {}", database_url()))
24+
.unwrap_or_else(|_| panic!("Error connecting to {}", database_url()))
2525
}
2626

2727
// fn init_pool() -> Result<PgPool, PoolError> {

src/db/queue_entries.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ pub fn remove_all(conn: &PgConnection) -> Result<(), diesel::result::Error> {
157157

158158
pub fn remove_multiple(
159159
conn: &PgConnection,
160-
entries: &Vec<QueueEntry>,
160+
entries: &[QueueEntry],
161161
) -> Result<(), diesel::result::Error> {
162162
diesel::delete(queue_entries::table.filter(
163-
queue_entries::id.eq_any::<Vec<i32>>(entries.into_iter().map(|entry| entry.id).collect()),
163+
queue_entries::id.eq_any::<Vec<i32>>(entries.iter().map(|entry| entry.id).collect()),
164164
))
165165
.execute(conn)
166166
.map(|_| ())

src/util.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ fn convert_to_ldap_user(mut rs: Vec<ResultEntry>) -> Option<LdapUser> {
7575
let mut entry = SearchEntry::construct(rs.pop()?);
7676
// println!("Got entry:\n{:?}", entry);
7777
Some(LdapUser {
78-
username: entry.attrs.get_mut(LDAP_USERNAME)?.pop()?.to_string(),
79-
ugkthid: entry.attrs.get_mut(LDAP_UGKTHID)?.pop()?.to_string(),
80-
realname: entry.attrs.get_mut(LDAP_REALNAME)?.pop()?.to_string(),
78+
username: entry.attrs.get_mut(LDAP_USERNAME)?.pop()?,
79+
ugkthid: entry.attrs.get_mut(LDAP_UGKTHID)?.pop()?,
80+
realname: entry.attrs.get_mut(LDAP_REALNAME)?.pop()?,
8181
})
8282
}
8383

0 commit comments

Comments
 (0)