From 1ccf9b23235685462eee57b3f07491b4e061a5a3 Mon Sep 17 00:00:00 2001 From: Meng Zhang Date: Mon, 11 Sep 2023 12:58:38 +0800 Subject: [PATCH] refactor: run make fix --- Cargo.toml | 1 + crates/http-api-bindings/src/fastchat.rs | 2 +- crates/tabby/src/serve/completions.rs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7e04bd2..63fca28 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [workspace] +resolver = "1" members = [ "crates/tabby", "crates/tabby-common", diff --git a/crates/http-api-bindings/src/fastchat.rs b/crates/http-api-bindings/src/fastchat.rs index a577b90..a97a1df 100644 --- a/crates/http-api-bindings/src/fastchat.rs +++ b/crates/http-api-bindings/src/fastchat.rs @@ -31,7 +31,7 @@ pub struct FastChatEngine { impl FastChatEngine { pub fn create(api_endpoint: &str, model_name: &str, authorization: &str) -> Self { let mut headers = reqwest::header::HeaderMap::new(); - if authorization.len() > 0 { + if !authorization.is_empty() { headers.insert( "Authorization", header::HeaderValue::from_str(authorization) diff --git a/crates/tabby/src/serve/completions.rs b/crates/tabby/src/serve/completions.rs index 8b345f9..1849e5d 100644 --- a/crates/tabby/src/serve/completions.rs +++ b/crates/tabby/src/serve/completions.rs @@ -145,7 +145,7 @@ impl CompletionState { fn get_param(params: &Value, key: &str) -> String { params .get(key) - .expect(format!("Missing {} field", key).as_str()) + .unwrap_or_else(|| panic!("Missing {} field", key)) .as_str() .expect("Type unmatched") .to_string()