From 1c110d173d2f1c9750d84db2e0864695fa910070 Mon Sep 17 00:00:00 2001 From: Anastasiia Solop <35258279+anastasiya1155@users.noreply.github.com> Date: Wed, 12 Jun 2024 10:38:13 +0200 Subject: [PATCH] fix compilation errors (unnecessary path segments) (#1277) --- server/bleep/src/background.rs | 2 +- server/bleep/src/cache.rs | 4 ++-- server/bleep/src/commits.rs | 2 +- server/bleep/src/indexes.rs | 4 ++-- server/bleep/src/indexes/schema.rs | 2 +- server/bleep/src/query/parser.rs | 2 +- server/bleep/src/repo.rs | 2 +- server/bleep/src/webserver.rs | 6 +++--- server/bleep/src/webserver/query.rs | 2 +- server/bleep/src/webserver/repos.rs | 2 +- server/bleep/src/webserver/search.rs | 2 +- server/bleep/src/webserver/studio.rs | 4 ++-- server/bleep/src/webserver/template.rs | 10 +++++----- 13 files changed, 22 insertions(+), 22 deletions(-) diff --git a/server/bleep/src/background.rs b/server/bleep/src/background.rs index f8838a8d0b..662e1aaac2 100644 --- a/server/bleep/src/background.rs +++ b/server/bleep/src/background.rs @@ -89,7 +89,7 @@ impl BackgroundExecutor { let tokio_ref = tokio_ref.clone(); let thread_priority = thread_priority::ThreadPriority::Max; - std::thread::Builder::new() + thread::Builder::new() .name("index-worker".to_owned()) .spawn_with_priority(thread_priority, move |_| { let _tokio = tokio_ref.enter(); diff --git a/server/bleep/src/cache.rs b/server/bleep/src/cache.rs index ac6511d120..a1f5478edc 100644 --- a/server/bleep/src/cache.rs +++ b/server/bleep/src/cache.rs @@ -548,7 +548,7 @@ impl<'a> ChunkCache<'a> { let branches_hash = blake3::hash(payload.branches.join("\n").as_ref()).to_string(); match self.cache.entry(id) { - scc::hash_map::Entry::Occupied(mut existing) => { + Entry::Occupied(mut existing) => { let key = existing.key(); trace!(?key, "found; not upserting new"); if existing.get().value != branches_hash { @@ -560,7 +560,7 @@ impl<'a> ChunkCache<'a> { } *existing.get_mut() = branches_hash.into(); } - scc::hash_map::Entry::Vacant(vacant) => { + Entry::Vacant(vacant) => { let key = vacant.key(); trace!(?key, "inserting new"); self.new_sql diff --git a/server/bleep/src/commits.rs b/server/bleep/src/commits.rs index 27b5d9e279..d9222e9b04 100644 --- a/server/bleep/src/commits.rs +++ b/server/bleep/src/commits.rs @@ -437,7 +437,7 @@ Assistant: initialisation"#, pub async fn generate_tutorial_questions( db: crate::db::SqlDb, - llm_gateway: Result, + llm_gateway: Result, repo_pool: RepositoryPool, reporef: RepoRef, ) -> Result<()> { diff --git a/server/bleep/src/indexes.rs b/server/bleep/src/indexes.rs index 2d9648cd69..bd2bb04738 100644 --- a/server/bleep/src/indexes.rs +++ b/server/bleep/src/indexes.rs @@ -118,11 +118,11 @@ impl Indexes { // we don't support old schemas, and tantivy will hard // error if we try to open a db with a different schema. if config.index_path("repo").as_ref().exists() { - std::fs::remove_dir_all(config.index_path("repo"))?; + fs::remove_dir_all(config.index_path("repo"))?; debug!("removed index repo dir") } if config.index_path("content").as_ref().exists() { - std::fs::remove_dir_all(config.index_path("content"))?; + fs::remove_dir_all(config.index_path("content"))?; debug!("removed index content dir") } Ok(()) diff --git a/server/bleep/src/indexes/schema.rs b/server/bleep/src/indexes/schema.rs index f7f0cd961a..f2f7d025f5 100644 --- a/server/bleep/src/indexes/schema.rs +++ b/server/bleep/src/indexes/schema.rs @@ -69,7 +69,7 @@ pub struct File { impl File { pub fn new() -> Self { - let mut builder = tantivy::schema::SchemaBuilder::new(); + let mut builder = SchemaBuilder::new(); let trigram = TextOptions::default().set_stored().set_indexing_options( TextFieldIndexing::default() .set_tokenizer("default") diff --git a/server/bleep/src/query/parser.rs b/server/bleep/src/query/parser.rs index 4f82efc00a..8be2b28eb0 100644 --- a/server/bleep/src/query/parser.rs +++ b/server/bleep/src/query/parser.rs @@ -356,7 +356,7 @@ impl<'a> Literal<'a> { /// Force this literal into the `Regex` variant. fn make_regex(&mut self) { - *self = match std::mem::take(self) { + *self = match mem::take(self) { Self::Plain(s) | Self::Regex(s) => Self::Regex(s), } } diff --git a/server/bleep/src/repo.rs b/server/bleep/src/repo.rs index 2868a816fe..9bdc2e0ea5 100644 --- a/server/bleep/src/repo.rs +++ b/server/bleep/src/repo.rs @@ -153,7 +153,7 @@ impl FromStr for RepoRef { } impl Display for RepoRef { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self.backend() { Backend::Github => write!(f, "github.com/{}", self.name()), Backend::Local => write!(f, "local/{}", self.name()), diff --git a/server/bleep/src/webserver.rs b/server/bleep/src/webserver.rs index 1a324ff999..f664f6eca9 100644 --- a/server/bleep/src/webserver.rs +++ b/server/bleep/src/webserver.rs @@ -254,7 +254,7 @@ impl Error { self } - fn internal(message: S) -> Self { + fn internal(message: S) -> Self { Error { status: StatusCode::INTERNAL_SERVER_ERROR, body: EndpointError { @@ -264,7 +264,7 @@ impl Error { } } - fn user(message: S) -> Self { + fn user(message: S) -> Self { Error { status: StatusCode::BAD_REQUEST, body: EndpointError { @@ -274,7 +274,7 @@ impl Error { } } - fn not_found(message: S) -> Self { + fn not_found(message: S) -> Self { Error { status: StatusCode::NOT_FOUND, body: EndpointError { diff --git a/server/bleep/src/webserver/query.rs b/server/bleep/src/webserver/query.rs index 498e6a80d2..dec4b8ab8a 100644 --- a/server/bleep/src/webserver/query.rs +++ b/server/bleep/src/webserver/query.rs @@ -16,5 +16,5 @@ pub(super) async fn handle( .query(&app) .await .map(json) - .map_err(super::Error::from) + .map_err(Error::from) } diff --git a/server/bleep/src/webserver/repos.rs b/server/bleep/src/webserver/repos.rs index 0e4929f2ce..bc29fbb992 100644 --- a/server/bleep/src/webserver/repos.rs +++ b/server/bleep/src/webserver/repos.rs @@ -168,7 +168,7 @@ impl Repo { last_update: origin.pushed_at.unwrap(), last_index: None, most_common_lang: None, - branch_filter: crate::repo::BranchFilterConfig::Select(vec![]), + branch_filter: BranchFilterConfig::Select(vec![]), file_filter: Default::default(), branches: vec![], } diff --git a/server/bleep/src/webserver/search.rs b/server/bleep/src/webserver/search.rs index 1c88cd8e15..a8d5eb4f2b 100644 --- a/server/bleep/src/webserver/search.rs +++ b/server/bleep/src/webserver/search.rs @@ -20,7 +20,7 @@ pub(super) async fn semantic_code( Ok(q) => semantic::execute::execute(semantic, q, args) .await .map(json) - .map_err(super::Error::from), + .map_err(Error::from), Err(err) => { error!(?err, "Couldn't parse query"); Err(Error::new(ErrorKind::UpstreamService, "error")) diff --git a/server/bleep/src/webserver/studio.rs b/server/bleep/src/webserver/studio.rs index d74e56c926..edb4850551 100644 --- a/server/bleep/src/webserver/studio.rs +++ b/server/bleep/src/webserver/studio.rs @@ -991,7 +991,7 @@ pub async fn diff( let response = llm_gateway.chat(&messages, None).await?; let diff_chunks = diff::extract(&response)?.collect::>(); - let valid_chunks = futures::stream::iter(diff_chunks) + let valid_chunks = stream::iter(diff_chunks) .map(|mut chunk| { let app = (*app).clone(); let llm_context = llm_context.clone(); @@ -1331,7 +1331,7 @@ pub async fn diff_apply( // Force a re-sync. for repo in dirty_repos { - let _ = crate::webserver::repos::sync( + let _ = webserver::repos::sync( Query(webserver::repos::RepoParams { repo, shallow: false, diff --git a/server/bleep/src/webserver/template.rs b/server/bleep/src/webserver/template.rs index 302fb43551..54530853aa 100644 --- a/server/bleep/src/webserver/template.rs +++ b/server/bleep/src/webserver/template.rs @@ -18,7 +18,7 @@ pub async fn create( ) -> webserver::Result { let user_id = user .username() - .ok_or_else(|| super::Error::user("didn't have user ID"))? + .ok_or_else(|| Error::user("didn't have user ID"))? .to_string(); let id = sqlx::query!( @@ -49,7 +49,7 @@ pub async fn list( ) -> webserver::Result>> { let user_id = user .username() - .ok_or_else(|| super::Error::user("didn't have user ID"))? + .ok_or_else(|| Error::user("didn't have user ID"))? .to_string(); let templates = sqlx::query_as!( @@ -72,7 +72,7 @@ pub async fn get( ) -> webserver::Result> { let user_id = user .username() - .ok_or_else(|| super::Error::user("didn't have user ID"))? + .ok_or_else(|| Error::user("didn't have user ID"))? .to_string(); let template = sqlx::query_as!( @@ -104,7 +104,7 @@ pub async fn patch( ) -> webserver::Result { let user_id = user .username() - .ok_or_else(|| super::Error::user("didn't have user ID"))? + .ok_or_else(|| Error::user("didn't have user ID"))? .to_string(); let mut transaction = app.sql.begin().await?; @@ -167,7 +167,7 @@ pub async fn delete( ) -> webserver::Result<()> { let user_id = user .username() - .ok_or_else(|| super::Error::user("didn't have user ID"))? + .ok_or_else(|| Error::user("didn't have user ID"))? .to_string(); sqlx::query!(