Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
crowlKats committed Dec 18, 2024
1 parent aa2c086 commit 9178daa
Show file tree
Hide file tree
Showing 15 changed files with 97 additions and 99 deletions.
8 changes: 4 additions & 4 deletions api/src/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ struct SyncLoader<'a> {
files: &'a HashMap<PackagePath, Vec<u8>>,
}

impl<'a> SyncLoader<'a> {
impl SyncLoader<'_> {
fn load_sync(
&self,
specifier: &ModuleSpecifier,
Expand Down Expand Up @@ -484,7 +484,7 @@ impl<'a> SyncLoader<'a> {
}
}

impl<'a> deno_graph::source::Loader for SyncLoader<'a> {
impl deno_graph::source::Loader for SyncLoader<'_> {
fn load(
&self,
specifier: &ModuleSpecifier,
Expand Down Expand Up @@ -628,7 +628,7 @@ struct GcsLoader<'a> {
version: &'a Version,
}

impl<'a> GcsLoader<'a> {
impl GcsLoader<'_> {
fn load_inner(
&self,
specifier: &ModuleSpecifier,
Expand Down Expand Up @@ -669,7 +669,7 @@ impl<'a> GcsLoader<'a> {
}
}

impl<'a> deno_graph::source::Loader for GcsLoader<'a> {
impl deno_graph::source::Loader for GcsLoader<'_> {
fn load(
&self,
specifier: &ModuleSpecifier,
Expand Down
10 changes: 5 additions & 5 deletions api/src/api/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ pub async fn update_user(mut req: Request<Body>) -> ApiResult<ApiFullUser> {
iam.check_admin_access()?;

let user_id = req.param_uuid("user_id")?;
Span::current().record("user_id", &field::display(&user_id));
Span::current().record("user_id", field::display(&user_id));
let ApiAdminUpdateUserRequest {
is_staff,
is_blocked,
Expand Down Expand Up @@ -172,7 +172,7 @@ pub async fn patch_scopes(mut req: Request<Body>) -> ApiResult<ApiFullScope> {
iam.check_admin_access()?;

let scope = req.param_scope()?;
Span::current().record("scope", &field::display(&scope));
Span::current().record("scope", field::display(&scope));

let ApiAdminUpdateScopeRequest {
package_limit,
Expand Down Expand Up @@ -214,8 +214,8 @@ pub async fn assign_scope(mut req: Request<Body>) -> ApiResult<ApiScope> {
iam.check_admin_access()?;

let ApiAssignScopeRequest { scope, user_id } = decode_json(&mut req).await?;
Span::current().record("scope", &field::display(&scope));
Span::current().record("user_id", &field::display(&user_id));
Span::current().record("scope", field::display(&scope));
Span::current().record("user_id", field::display(&user_id));

let db = req.data::<Database>().unwrap();

Expand Down Expand Up @@ -268,7 +268,7 @@ pub async fn requeue_publishing_tasks(req: Request<Body>) -> ApiResult<()> {

let publishing_task_id = req.param_uuid("publishing_task")?;
Span::current()
.record("publishing_task", &field::display(&publishing_task_id));
.record("publishing_task", field::display(&publishing_task_id));

let db = req.data::<Database>().unwrap().clone();
let task = db
Expand Down
8 changes: 4 additions & 4 deletions api/src/api/authorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ mod tests {

async fn details(t: &mut TestSetup, code: &str) -> Response<Body> {
t.http()
.get(&format!("/api/authorizations/details/{}", code))
.get(format!("/api/authorizations/details/{}", code))
.call()
.await
.unwrap()
Expand Down Expand Up @@ -335,7 +335,7 @@ mod tests {

let mut resp = t
.http()
.post(&format!("/api/authorizations/approve/{}", auth.code))
.post(format!("/api/authorizations/approve/{}", auth.code))
.call()
.await
.unwrap();
Expand Down Expand Up @@ -399,7 +399,7 @@ mod tests {

let mut resp = t
.http()
.post(&format!("/api/authorizations/approve/{}", auth.code))
.post(format!("/api/authorizations/approve/{}", auth.code))
.call()
.await
.unwrap();
Expand Down Expand Up @@ -454,7 +454,7 @@ mod tests {

let mut resp = t
.http()
.post(&format!("/api/authorizations/deny/{}", auth.code))
.post(format!("/api/authorizations/deny/{}", auth.code))
.call()
.await
.unwrap();
Expand Down
96 changes: 48 additions & 48 deletions api/src/api/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ pub async fn list_handler(
req: Request<Body>,
) -> ApiResult<ApiList<ApiPackage>> {
let scope = req.param_scope()?;
Span::current().record("scope", &field::display(&scope));
Span::current().record("scope", field::display(&scope));

let (start, limit) = pagination(&req);

Expand All @@ -250,12 +250,12 @@ pub async fn list_handler(
)]
pub async fn create_handler(mut req: Request<Body>) -> ApiResult<ApiPackage> {
let scope = req.param_scope()?;
Span::current().record("scope", &field::display(&scope));
Span::current().record("scope", field::display(&scope));

let ApiCreatePackageRequest {
package: package_name,
} = decode_json(&mut req).await?;
Span::current().record("package", &field::display(&package_name));
Span::current().record("package", field::display(&package_name));

let iam = req.iam();
iam.check_scope_write_access(&scope).await?;
Expand Down Expand Up @@ -298,8 +298,8 @@ pub async fn get_handler(req: Request<Body>) -> ApiResult<ApiPackage> {
let scope = req.param_scope()?;
let package = req.param_package()?;

Span::current().record("scope", &field::display(&scope));
Span::current().record("package", &field::display(&package));
Span::current().record("scope", field::display(&scope));
Span::current().record("package", field::display(&package));

let db = req.data::<Database>().unwrap();
let package = db
Expand Down Expand Up @@ -540,8 +540,8 @@ pub async fn list_versions_handler(
let scope = req.param_scope()?;
let package = req.param_package()?;

Span::current().record("scope", &field::display(&scope));
Span::current().record("package", &field::display(&package));
Span::current().record("scope", field::display(&scope));
Span::current().record("package", field::display(&package));

let db = req.data::<Database>().unwrap();

Expand Down Expand Up @@ -608,9 +608,9 @@ pub async fn get_version_handler(
let scope = req.param_scope()?;
let package = req.param_package()?;
let version = req.param_version_or_latest()?;
Span::current().record("scope", &field::display(&scope));
Span::current().record("package", &field::display(&package));
Span::current().record("version", &field::display(&version));
Span::current().record("scope", field::display(&scope));
Span::current().record("package", field::display(&package));
Span::current().record("version", field::display(&version));

let db = req.data::<Database>().unwrap();
let _ = db
Expand Down Expand Up @@ -645,9 +645,9 @@ pub async fn version_publish_handler(
let package_scope = req.param_scope()?;
let package_name = req.param_package()?;
let package_version = req.param_version()?;
Span::current().record("scope", &field::display(&package_scope));
Span::current().record("package", &field::display(&package_name));
Span::current().record("version", &field::display(&package_version));
Span::current().record("scope", field::display(&package_scope));
Span::current().record("package", field::display(&package_name));
Span::current().record("version", field::display(&package_version));
let config_file =
PackagePath::try_from(&**req.query("config").ok_or_else(|| {
let msg = "Missing query parameter 'config'".into();
Expand Down Expand Up @@ -813,9 +813,9 @@ pub async fn version_provenance_statements_handler(
let package = req.param_package()?;
let version = req.param_version()?;

Span::current().record("scope", &field::display(&scope));
Span::current().record("package", &field::display(&package));
Span::current().record("version", &field::display(&version));
Span::current().record("scope", field::display(&scope));
Span::current().record("package", field::display(&package));
Span::current().record("version", field::display(&version));

let body: ApiProvenanceStatementRequest = decode_json(&mut req).await?;

Expand All @@ -835,7 +835,7 @@ pub async fn version_provenance_statements_handler(
let (package, _, meta) = db
.get_package(&scope, &package)
.await?
.ok_or_else(|| ApiError::InternalServerError)?;
.ok_or(ApiError::InternalServerError)?;
orama_client.upsert_package(&package, &meta);
}

Expand All @@ -859,9 +859,9 @@ pub async fn version_update_handler(
let scope = req.param_scope()?;
let package = req.param_package()?;
let version = req.param_version()?;
Span::current().record("scope", &field::display(&scope));
Span::current().record("package", &field::display(&package));
Span::current().record("version", &field::display(&version));
Span::current().record("scope", field::display(&scope));
Span::current().record("package", field::display(&package));
Span::current().record("version", field::display(&version));

// WARNING: if an additional option gets added, then yanked time rendering needs to be changed in package/versions.tsx
let body: ApiUpdatePackageVersionRequest = decode_json(&mut req).await?;
Expand Down Expand Up @@ -933,17 +933,17 @@ pub async fn get_docs_handler(
let scope = req.param_scope()?;
let package_name = req.param_package()?;
let version_or_latest = req.param_version_or_latest()?;
Span::current().record("scope", &field::display(&scope));
Span::current().record("package", &field::display(&package_name));
Span::current().record("version", &field::display(&version_or_latest));
Span::current().record("scope", field::display(&scope));
Span::current().record("package", field::display(&package_name));
Span::current().record("version", field::display(&version_or_latest));
let all_symbols = req.query("all_symbols").is_some();
Span::current().record("all_symbols", &field::display(&all_symbols));
Span::current().record("all_symbols", field::display(&all_symbols));
let entrypoint = req.query("entrypoint").and_then(|s| match s.as_str() {
"" => None,
s => Some(s),
});
Span::current()
.record("entrypoint", &field::display(&entrypoint.unwrap_or("")));
.record("entrypoint", field::display(&entrypoint.unwrap_or("")));

let symbol = req
.query("symbol")
Expand All @@ -953,7 +953,7 @@ pub async fn get_docs_handler(
})
.transpose()?;
Span::current()
.record("symbol", &field::display(&symbol.as_deref().unwrap_or("")));
.record("symbol", field::display(&symbol.as_deref().unwrap_or("")));

if all_symbols && (entrypoint.is_some() || symbol.is_some()) {
return Err(ApiError::MalformedRequest {
Expand Down Expand Up @@ -1087,9 +1087,9 @@ pub async fn get_docs_search_handler(
let scope = req.param_scope()?;
let package_name = req.param_package()?;
let version_or_latest = req.param_version_or_latest()?;
Span::current().record("scope", &field::display(&scope));
Span::current().record("package", &field::display(&package_name));
Span::current().record("version", &field::display(&version_or_latest));
Span::current().record("scope", field::display(&scope));
Span::current().record("package", field::display(&package_name));
Span::current().record("version", field::display(&version_or_latest));

let db = req.data::<Database>().unwrap();
let buckets = req.data::<Buckets>().unwrap();
Expand Down Expand Up @@ -1158,9 +1158,9 @@ pub async fn get_docs_search_html_handler(
let scope = req.param_scope()?;
let package_name = req.param_package()?;
let version_or_latest = req.param_version_or_latest()?;
Span::current().record("scope", &field::display(&scope));
Span::current().record("package", &field::display(&package_name));
Span::current().record("version", &field::display(&version_or_latest));
Span::current().record("scope", field::display(&scope));
Span::current().record("package", field::display(&package_name));
Span::current().record("version", field::display(&version_or_latest));

let db = req.data::<Database>().unwrap();
let buckets = req.data::<Buckets>().unwrap();
Expand Down Expand Up @@ -1240,10 +1240,10 @@ pub async fn get_source_handler(
let version_or_latest = req.param_version_or_latest()?;
let path = req.query("path").cloned().unwrap_or("/".to_string());

Span::current().record("scope", &field::display(&scope));
Span::current().record("package", &field::display(&package));
Span::current().record("version", &field::display(&version_or_latest));
Span::current().record("path", &field::display(&path));
Span::current().record("scope", field::display(&scope));
Span::current().record("package", field::display(&package));
Span::current().record("version", field::display(&version_or_latest));
Span::current().record("path", field::display(&path));

let db = req.data::<Database>().unwrap();
let buckets = req.data::<Buckets>().unwrap();
Expand Down Expand Up @@ -1397,8 +1397,8 @@ pub async fn list_dependents_handler(
) -> ApiResult<ApiList<ApiDependent>> {
let scope = req.param_scope()?;
let package = req.param_package()?;
Span::current().record("scope", &field::display(&scope));
Span::current().record("package", &field::display(&package));
Span::current().record("scope", field::display(&scope));
Span::current().record("package", field::display(&package));

let (start, limit) = pagination(&req);
let versions_per_package_limit = req
Expand Down Expand Up @@ -1440,8 +1440,8 @@ pub async fn get_downloads_handler(
) -> ApiResult<ApiPackageDownloads> {
let scope = req.param_scope()?;
let package = req.param_package()?;
Span::current().record("scope", &field::display(&scope));
Span::current().record("package", &field::display(&package));
Span::current().record("scope", field::display(&scope));
Span::current().record("package", field::display(&package));

let db = req.data::<Database>().unwrap();
db.get_package(&scope, &package)
Expand Down Expand Up @@ -1499,9 +1499,9 @@ pub async fn list_dependencies_handler(
let scope = req.param_scope()?;
let package = req.param_package()?;
let version = req.param_version()?;
Span::current().record("scope", &field::display(&scope));
Span::current().record("package", &field::display(&package));
Span::current().record("version", &field::display(&version));
Span::current().record("scope", field::display(&scope));
Span::current().record("package", field::display(&package));
Span::current().record("version", field::display(&version));

let db = req.data::<Database>().unwrap();

Expand Down Expand Up @@ -1531,8 +1531,8 @@ pub async fn list_publishing_tasks_handler(
) -> ApiResult<Vec<ApiPublishingTask>> {
let scope = req.param_scope()?;
let package = req.param_package()?;
Span::current().record("scope", &field::display(&scope));
Span::current().record("package", &field::display(&package));
Span::current().record("scope", field::display(&scope));
Span::current().record("package", field::display(&package));

let db = req.data::<Database>().unwrap();

Expand Down Expand Up @@ -1562,8 +1562,8 @@ pub async fn get_score_handler(
) -> ApiResult<ApiPackageScore> {
let scope = req.param_scope()?;
let package = req.param_package()?;
Span::current().record("scope", &field::display(&scope));
Span::current().record("package", &field::display(&package));
Span::current().record("scope", field::display(&scope));
Span::current().record("package", field::display(&package));

let db = req.data::<Database>().unwrap();
let (pkg, _, meta) = db
Expand Down Expand Up @@ -3359,7 +3359,7 @@ ggHohNAjhbzDaY2iBW/m3NC5dehGUP4T2GBo/cwGhg==
assert_eq!(tasks.len(), 1);

t.http()
.delete(&format!(
.delete(format!(
"/api/scopes/{}/packages/{}",
scope_name, package_name
))
Expand Down
2 changes: 1 addition & 1 deletion api/src/api/publishing_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn publishing_task_router() -> Router<Body, ApiError> {
pub async fn get_handler(req: Request<Body>) -> ApiResult<ApiPublishingTask> {
let publishing_task_id = req.param_uuid("publishing_task_id")?;
Span::current()
.record("publishing_task_id", &field::display(&publishing_task_id));
.record("publishing_task_id", field::display(&publishing_task_id));

let db = req.data::<Database>().unwrap();

Expand Down
Loading

0 comments on commit 9178daa

Please sign in to comment.