clippy fixes

This commit is contained in:
Valentin Tolmer 2021-05-10 09:33:33 +02:00
parent c33948ccc2
commit 5abff453b9
2 changed files with 8 additions and 6 deletions

View File

@ -136,7 +136,7 @@ impl BackendHandler for SqlBackendHandler {
while let Some(row) = results.try_next().await? { while let Some(row) = results.try_next().await? {
let display_name = row.get::<String, _>("display_name"); let display_name = row.get::<String, _>("display_name");
if display_name != current_group { if display_name != current_group {
if current_group != "" { if !current_group.is_empty() {
groups.push(Group { groups.push(Group {
display_name: current_group, display_name: current_group,
users: current_users, users: current_users,
@ -232,9 +232,11 @@ mod tests {
#[tokio::test] #[tokio::test]
async fn test_bind_admin() { async fn test_bind_admin() {
let sql_pool = get_in_memory_db().await; let sql_pool = get_in_memory_db().await;
let mut config = Configuration::default(); let config = Configuration {
config.ldap_user_dn = "admin".to_string(); ldap_user_dn: "admin".to_string(),
config.ldap_user_pass = "test".to_string(); ldap_user_pass: "test".to_string(),
..Default::default()
};
let handler = SqlBackendHandler::new(config, sql_pool); let handler = SqlBackendHandler::new(config, sql_pool);
handler handler
.bind(BindRequest { .bind(BindRequest {

View File

@ -101,13 +101,13 @@ fn convert_filter(filter: &LdapFilter) -> Result<RequestFilter> {
match filter { match filter {
LdapFilter::And(filters) => Ok(RequestFilter::And( LdapFilter::And(filters) => Ok(RequestFilter::And(
filters filters
.into_iter() .iter()
.map(convert_filter) .map(convert_filter)
.collect::<Result<_>>()?, .collect::<Result<_>>()?,
)), )),
LdapFilter::Or(filters) => Ok(RequestFilter::Or( LdapFilter::Or(filters) => Ok(RequestFilter::Or(
filters filters
.into_iter() .iter()
.map(convert_filter) .map(convert_filter)
.collect::<Result<_>>()?, .collect::<Result<_>>()?,
)), )),