Skip to content

Commit

Permalink
Fix Clippy Warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
benfaerber committed Dec 31, 2024
1 parent b564486 commit e061773
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/import/src/rest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fn build_authentication(r_auth: RestAuthorization) -> Authentication {
RestAuthorization::Basic { username, password } => {
Authentication::Basic {
username: Template::raw(username),
password: password.map(|p| Template::raw(p)),
password: password.map(Template::raw),
}
}
}
Expand All @@ -119,7 +119,7 @@ fn try_build_chain_from_load_body(
let path = try_build_slumber_template(filepath)?;

let content_type =
guess_is_json(headers, variables).then(|| ContentType::Json);
guess_is_json(headers, variables).then_some(ContentType::Json);

Ok(Chain {
id: id.into(),
Expand Down Expand Up @@ -148,7 +148,7 @@ fn guess_content_type(
headers: &IndexMap<String, RestTemplate>,
variables: &RestVariables,
) -> Option<ContentType> {
guess_is_json(headers, variables).then(|| ContentType::Json)
guess_is_json(headers, variables).then_some(ContentType::Json)
}

fn try_build_body(
Expand Down Expand Up @@ -202,7 +202,7 @@ fn try_build_recipe(
index: usize,
variables: &RestVariables,
) -> anyhow::Result<CompleteRecipe> {
let name = request.name.unwrap_or(format!("Request"));
let name = request.name.unwrap_or("Request".to_string());

let slug = Identifier::escape(&name);
// Add the index to prevent duplicate ID error
Expand All @@ -222,7 +222,7 @@ fn try_build_recipe(

let complete_body = request
.body
.map(|b| try_build_body(b, &id, &request.headers, &variables));
.map(|b| try_build_body(b, &id, &request.headers, variables));

let (body, chain) = match complete_body {
Some(Ok(complete)) => (Some(complete.recipe_body), complete.chain),
Expand Down

0 comments on commit e061773

Please sign in to comment.