Skip to content

Commit

Permalink
fix compilation errors (unnecessary path segments) (#1277)
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasiya1155 committed Jun 12, 2024
1 parent 8c24fef commit 1c110d1
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion server/bleep/src/background.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions server/bleep/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion server/bleep/src/commits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ Assistant: initialisation"#,

pub async fn generate_tutorial_questions(
db: crate::db::SqlDb,
llm_gateway: Result<crate::llm::client::Client>,
llm_gateway: Result<llm::client::Client>,
repo_pool: RepositoryPool,
reporef: RepoRef,
) -> Result<()> {
Expand Down
4 changes: 2 additions & 2 deletions server/bleep/src/indexes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
2 changes: 1 addition & 1 deletion server/bleep/src/indexes/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion server/bleep/src/query/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}
Expand Down
2 changes: 1 addition & 1 deletion server/bleep/src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down
6 changes: 3 additions & 3 deletions server/bleep/src/webserver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ impl Error {
self
}

fn internal<S: std::fmt::Display>(message: S) -> Self {
fn internal<S: fmt::Display>(message: S) -> Self {
Error {
status: StatusCode::INTERNAL_SERVER_ERROR,
body: EndpointError {
Expand All @@ -264,7 +264,7 @@ impl Error {
}
}

fn user<S: std::fmt::Display>(message: S) -> Self {
fn user<S: fmt::Display>(message: S) -> Self {
Error {
status: StatusCode::BAD_REQUEST,
body: EndpointError {
Expand All @@ -274,7 +274,7 @@ impl Error {
}
}

fn not_found<S: std::fmt::Display>(message: S) -> Self {
fn not_found<S: fmt::Display>(message: S) -> Self {
Error {
status: StatusCode::NOT_FOUND,
body: EndpointError {
Expand Down
2 changes: 1 addition & 1 deletion server/bleep/src/webserver/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ pub(super) async fn handle(
.query(&app)
.await
.map(json)
.map_err(super::Error::from)
.map_err(Error::from)
}
2 changes: 1 addition & 1 deletion server/bleep/src/webserver/repos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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![],
}
Expand Down
2 changes: 1 addition & 1 deletion server/bleep/src/webserver/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
4 changes: 2 additions & 2 deletions server/bleep/src/webserver/studio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ pub async fn diff(
let response = llm_gateway.chat(&messages, None).await?;
let diff_chunks = diff::extract(&response)?.collect::<Vec<_>>();

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();
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions server/bleep/src/webserver/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub async fn create(
) -> webserver::Result<String> {
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!(
Expand Down Expand Up @@ -49,7 +49,7 @@ pub async fn list(
) -> webserver::Result<Json<Vec<Template>>> {
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!(
Expand All @@ -72,7 +72,7 @@ pub async fn get(
) -> webserver::Result<Json<Template>> {
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!(
Expand Down Expand Up @@ -104,7 +104,7 @@ pub async fn patch(
) -> webserver::Result<String> {
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?;
Expand Down Expand Up @@ -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!(
Expand Down

0 comments on commit 1c110d1

Please sign in to comment.