Skip to content

Commit 478c8c2

Browse files
author
Alex
committed
Fix clippy warnings: unnecessary_map_or and uninlined_format_args
- Use is_some_and() instead of map_or(false, ...) for Option check - Use inline format args with {previous_id} in format! macro
1 parent 85b8a66 commit 478c8c2

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

src/interactive/commands.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ impl PiApp {
856856
.model_entry
857857
.api_key
858858
.as_deref()
859-
.map_or(false, |k| !k.is_empty())
859+
.is_some_and(|k| !k.is_empty())
860860
|| !model_requires_configured_credential(&self.model_entry);
861861
if !model_still_authenticated {
862862
self.auto_switch_to_authenticated_model(&auth, &changed_canonical);
@@ -913,25 +913,27 @@ impl PiApp {
913913
}
914914

915915
let resolved_key_opt = resolved_key_for(&next);
916-
let provider_impl =
917-
match crate::providers::create_provider(&next, self.extensions.as_ref()) {
918-
Ok(p) => p,
919-
Err(err) => {
920-
self.status_message = Some(format!("Auto-switch failed: {err}"));
921-
return;
922-
}
923-
};
916+
let provider_impl = match crate::providers::create_provider(&next, self.extensions.as_ref())
917+
{
918+
Ok(p) => p,
919+
Err(err) => {
920+
self.status_message = Some(format!("Auto-switch failed: {err}"));
921+
return;
922+
}
923+
};
924924

925925
let previous_id = format!(
926926
"{}/{}",
927927
self.model_entry.model.provider, self.model_entry.model.id
928928
);
929-
if let Err(message) =
930-
self.switch_active_model(&next, provider_impl, resolved_key_opt.as_deref(), "auth-sync")
931-
{
929+
if let Err(message) = self.switch_active_model(
930+
&next,
931+
provider_impl,
932+
resolved_key_opt.as_deref(),
933+
"auth-sync",
934+
) {
932935
self.status_message = Some(format!(
933-
"Auto-switch from {} aborted: {message}. Use /model <provider/model> to pick one manually.",
934-
previous_id
936+
"Auto-switch from {previous_id} aborted: {message}. Use /model <provider/model> to pick one manually."
935937
));
936938
return;
937939
}

0 commit comments

Comments
 (0)