Skip to content

Commit

Permalink
fix: fix some warning
Browse files Browse the repository at this point in the history
  • Loading branch information
zensh committed Oct 6, 2023
1 parent 89cf241 commit 59699ed
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "jarvis"
version = "1.1.0"
version = "1.1.1"
edition = "2021"
rust-version = "1.64"
description = ""
Expand Down
2 changes: 1 addition & 1 deletion src/api/embedding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub async fn search(
return Ok(to.with(SuccessResponse::new(vec![])));
}

let rctx = ctx.as_ref().clone();
let rctx = ctx.as_ref();
let embedding_res = app
.ai
.embedding(rctx, &vec![q.clone()])
Expand Down
2 changes: 1 addition & 1 deletion src/api/message_translating.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ async fn translate(
mpsc::channel::<(usize, ReqContext, Result<(u32, TEContentList), HTTPError>)>(pieces);
for (i, unit) in content.into_iter().enumerate() {
let rid = rid.clone();
let user = user;
let user = user.clone();

Check warning on line 206 in src/api/message_translating.rs

View workflow job for this annotation

GitHub Actions / test

using `clone` on type `Id` which implements the `Copy` trait
let app = app.clone();
let origin = origin_language.to_name();
let lang = te.language.to_name();
Expand Down
2 changes: 1 addition & 1 deletion src/api/summarizing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ async fn summarize(app: Arc<AppState>, rid: String, user: xid::Id, te: TEParams)

for (i, text) in content.into_iter().enumerate() {
let rid = rid.clone();
let user = user;
let user = user.clone();
let app = app.clone();
let lang = te.language.to_name();
let tx = tx.clone();
Expand Down
6 changes: 3 additions & 3 deletions src/api/translating.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ async fn translate(
mpsc::channel::<(usize, ReqContext, Result<(u32, TEContentList), HTTPError>)>(pieces);
for (i, unit) in content.into_iter().enumerate() {
let rid = rid.clone();
let user = user;
let user = user.clone();
let app = app.clone();
let origin = origin_language.to_name();
let lang = te.language.to_name();
Expand Down Expand Up @@ -418,8 +418,8 @@ async fn translate(

// save target lang doc to db
let content = cbor_to_vec(&content_list);
if content.is_err() {
let err = content.unwrap_err().to_string();
if let Err(err) = content {
let err = err.to_string();
let mut cols = ColumnsMap::with_capacity(2);
cols.set_as("updated_at", &(unix_ms() as i64));
cols.set_as("error", &err);
Expand Down
9 changes: 4 additions & 5 deletions src/db/scylladb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,11 @@ pub async fn exec_cqls(db: &ScyllaDB, cqls: &str) -> anyhow::Result<()> {
.execute(cql.clone(), &[])
.await
.map_err(|err| anyhow::anyhow!("\ncql: {}\nerror: {}", &cql, &err));
if res.is_err() {
let res = res.unwrap_err();
if res.to_string().contains("Index already exists") {
println!("WARN: {}", res);
if let Err(err) = res {
if err.to_string().contains("Index already exists") {
println!("WARN: {}", err);
} else {
return Err(res);
return Err(err);
}
}
}
Expand Down

0 comments on commit 59699ed

Please sign in to comment.