Skip to content

Commit e8f777c

Browse files
committed
self_review
1 parent b2ae37b commit e8f777c

File tree

9 files changed

+27
-34
lines changed

9 files changed

+27
-34
lines changed

lib/api_projects/src/benchmarks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ async fn get_one_inner(
282282
)?;
283283

284284
QueryBenchmark::belonging_to(&query_project)
285-
.filter(QueryBenchmark::eq_resource_id(&path_params.benchmark)?)
285+
.filter(QueryBenchmark::eq_resource_id(&path_params.benchmark))
286286
.first::<QueryBenchmark>(conn_lock!(context))
287287
.map(|benchmark| benchmark.into_json_for_project(&query_project))
288288
.map_err(resource_not_found_err!(

lib/api_projects/src/branches.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ async fn get_one_inner(
306306
)?;
307307

308308
let query_branch = QueryBranch::belonging_to(&query_project)
309-
.filter(QueryBranch::eq_resource_id(&path_params.branch)?)
309+
.filter(QueryBranch::eq_resource_id(&path_params.branch))
310310
.first::<QueryBranch>(conn_lock!(context))
311311
.map_err(resource_not_found_err!(
312312
Branch,

lib/api_projects/src/measures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ async fn get_one_inner(
281281
)?;
282282

283283
QueryMeasure::belonging_to(&query_project)
284-
.filter(QueryMeasure::eq_resource_id(&path_params.measure)?)
284+
.filter(QueryMeasure::eq_resource_id(&path_params.measure))
285285
.first::<QueryMeasure>(conn_lock!(context))
286286
.map(|measure| measure.into_json_for_project(&query_project))
287287
.map_err(resource_not_found_err!(

lib/api_projects/src/testbeds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ async fn get_one_inner(
281281
)?;
282282

283283
QueryTestbed::belonging_to(&query_project)
284-
.filter(QueryTestbed::eq_resource_id(&path_params.testbed)?)
284+
.filter(QueryTestbed::eq_resource_id(&path_params.testbed))
285285
.first::<QueryTestbed>(conn_lock!(context))
286286
.map(|testbed| testbed.into_json_for_project(&query_project))
287287
.map_err(resource_not_found_err!(

lib/bencher_client/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ from_client!(
4141
Index,
4242
Jwt,
4343
NonEmpty,
44-
// ResourceId,
4544
ResourceName,
4645
SampleSize,
4746
Slug,

lib/bencher_json/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use std::sync::LazyLock;
33
pub use bencher_context::RunContext;
44
pub use bencher_valid::{
55
BenchmarkName, Boundary, BranchName, CdfBoundary, DateTime, DateTimeMillis, Email, GitHash,
6-
Index, IqrBoundary, Jwt, Model, ModelTest, NameId, NonEmpty, PercentageBoundary, ResourceId,
7-
ResourceName, SampleSize, Sanitize, Search, Secret, Slug, IntoResourceId, Units, Url, UserName,
8-
ValidError, Window,
6+
Index, IntoResourceId, IqrBoundary, Jwt, Model, ModelTest, NameId, NonEmpty,
7+
PercentageBoundary, ResourceId, ResourceName, SampleSize, Sanitize, Search, Secret, Slug,
8+
Units, Url, UserName, ValidError, Window,
99
};
1010
#[cfg(feature = "plus")]
1111
pub use bencher_valid::{

lib/bencher_schema/src/macros/name_id.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@ macro_rules! fn_eq_name_id {
22
($name:ident, $table:ident, $name_id:ident) => {
33
pub fn eq_name_id(
44
name_id: &bencher_json::$name_id,
5-
) -> Result<
6-
Box<
7-
dyn diesel::BoxableExpression<
8-
$crate::schema::$table::table,
9-
diesel::sqlite::Sqlite,
10-
SqlType = diesel::sql_types::Bool,
11-
>,
12-
>,
13-
dropshot::HttpError,
5+
) -> Box<
6+
dyn diesel::BoxableExpression<
7+
$crate::schema::$table::table,
8+
diesel::sqlite::Sqlite,
9+
SqlType = diesel::sql_types::Bool,
10+
>,
1411
> {
15-
Ok(match name_id {
12+
match name_id {
1613
bencher_json::NameId::Uuid(uuid) => {
1714
Box::new($crate::schema::$table::uuid.eq(uuid.to_string()))
1815
},
@@ -22,7 +19,7 @@ macro_rules! fn_eq_name_id {
2219
bencher_json::NameId::Name(name) => {
2320
Box::new($crate::schema::$table::name.eq(name.to_string()))
2421
},
25-
})
22+
}
2623
}
2724
};
2825
}
@@ -38,7 +35,7 @@ macro_rules! fn_from_name_id {
3835
) -> Result<Self, HttpError> {
3936
schema::$table::table
4037
.filter(schema::$table::project_id.eq(project_id))
41-
.filter(Self::eq_name_id(name_id)?)
38+
.filter(Self::eq_name_id(name_id))
4239
.first::<Self>(conn)
4340
.map_err(crate::error::resource_not_found_err!(
4441
$resource,

lib/bencher_schema/src/macros/resource_id.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,21 @@ macro_rules! fn_eq_resource_id {
22
($table:ident, $resource_id:ident) => {
33
pub fn eq_resource_id(
44
resource_id: &bencher_json::$resource_id,
5-
) -> Result<
6-
Box<
7-
dyn diesel::BoxableExpression<
8-
$crate::schema::$table::table,
9-
diesel::sqlite::Sqlite,
10-
SqlType = diesel::sql_types::Bool,
11-
>,
12-
>,
13-
dropshot::HttpError,
5+
) -> Box<
6+
dyn diesel::BoxableExpression<
7+
$crate::schema::$table::table,
8+
diesel::sqlite::Sqlite,
9+
SqlType = diesel::sql_types::Bool,
10+
>,
1411
> {
15-
Ok(match resource_id {
12+
match resource_id {
1613
bencher_json::ResourceId::Uuid(uuid) => {
1714
Box::new($crate::schema::$table::uuid.eq(uuid.to_string()))
1815
},
1916
bencher_json::ResourceId::Slug(slug) => {
2017
Box::new($crate::schema::$table::slug.eq(slug.to_string()))
2118
},
22-
})
19+
}
2320
}
2421
};
2522
}
@@ -35,7 +32,7 @@ macro_rules! fn_from_resource_id {
3532
) -> Result<Self, HttpError> {
3633
schema::$table::table
3734
.filter(schema::$table::$parent.eq(parent))
38-
.filter(Self::eq_resource_id(resource_id)?)
35+
.filter(Self::eq_resource_id(resource_id))
3936
.first::<Self>(conn)
4037
.map_err($crate::error::resource_not_found_err!(
4138
$resource,
@@ -49,7 +46,7 @@ macro_rules! fn_from_resource_id {
4946
resource_id: &bencher_json::$resource_id,
5047
) -> Result<Self, HttpError> {
5148
schema::$table::table
52-
.filter(Self::eq_resource_id(resource_id)?)
49+
.filter(Self::eq_resource_id(resource_id))
5350
.first::<Self>(conn)
5451
.map_err($crate::error::resource_not_found_err!(
5552
$resource,

services/cli/src/bencher/sub/user/user/update.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use bencher_client::types::JsonUpdateUser;
2-
use bencher_json::{Email, UserSlug, UserName, UserResourceId};
2+
use bencher_json::{Email, UserName, UserResourceId, UserSlug};
33

44
use crate::{
55
CliError,

0 commit comments

Comments
 (0)