Skip to content

Commit 607f0ed

Browse files
Fix linter violations (#341)
Fixes the linter violations. Signed-off-by: Rémy Greinhofer <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 7589816 commit 607f0ed

File tree

3 files changed

+10
-115
lines changed

3 files changed

+10
-115
lines changed

lambdas/src/core/link_header.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl<'a> RelationType<'a> {
5959
/// assert_eq!(RelationType::parse(r#" ; rel="prev""#), Ok(("", RelationType::new("prev"))));
6060
/// assert_eq!(RelationType::parse(r#" ; rel="alternate stylesheet""#), Ok(("", RelationType::new("alternate stylesheet"))));
6161
/// ```
62-
pub fn parse(i: &str) -> IResult<&str, RelationType> {
62+
pub fn parse(i: &str) -> IResult<&str, RelationType<'_>> {
6363
let (i, _) = space0(i)?;
6464
let (i, _) = tag(";")(i)?;
6565
let (i, _) = space0(i)?;
@@ -141,6 +141,12 @@ impl Display for Link<'_> {
141141
}
142142
}
143143

144+
impl<'a> Default for Link<'a> {
145+
fn default() -> Self {
146+
Self::new()
147+
}
148+
}
149+
144150
impl<'a> Link<'a> {
145151
/// Recognizes a Link.
146152
///
@@ -150,7 +156,7 @@ impl<'a> Link<'a> {
150156
///
151157
/// let link = Link::parse(r#"link: <https://api.github.com/repositories/1300192/issues?page=2>; rel="prev""#).unwrap();
152158
/// ```
153-
pub fn parse(i: &str) -> IResult<&str, Link> {
159+
pub fn parse(i: &str) -> IResult<&str, Link<'_>> {
154160
let (i, _) = alt((tag("Link:"), tag("link:")))(i)?;
155161
let (i, _) = space1(i)?;
156162
let (i, links) = separated_list1(tag(", "), LinkValues::parse)(i)?;
@@ -291,7 +297,7 @@ impl<'a> LinkValues<'a> {
291297
}
292298
}
293299

294-
pub fn parse(i: &str) -> IResult<&str, LinkValues> {
300+
pub fn parse(i: &str) -> IResult<&str, LinkValues<'_>> {
295301
let (i, uri) = LinkTarget::parse(i)?;
296302
let (i, link_params) = many1(LinkParam::parse)(i)?;
297303
let lv = LinkValues::try_from_link_params(uri, &link_params);
@@ -341,7 +347,7 @@ impl<'a> LinkParam<'a> {
341347
self.token
342348
}
343349

344-
pub fn parse(i: &str) -> IResult<&str, LinkParam> {
350+
pub fn parse(i: &str) -> IResult<&str, LinkParam<'_>> {
345351
let (i, _) = space0(i)?;
346352
let (i, _) = tag(";")(i)?;
347353
let (i, _) = space0(i)?;

lambdas/src/core/resource/ratings/db.rs

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -59,76 +59,6 @@ pub(crate) struct Bna {
5959
pub(crate) track: Option<f64>,
6060
}
6161

62-
#[derive(Debug, FromQueryResult, Deserialize, Serialize)]
63-
pub struct Summary {
64-
id: Uuid,
65-
city_id: Uuid,
66-
score: f64,
67-
version: String,
68-
}
69-
70-
#[derive(Debug, FromQueryResult, Deserialize, Serialize)]
71-
pub struct Infrastructure {
72-
low_stress_miles: Option<f64>,
73-
high_stress_miles: Option<f64>,
74-
}
75-
76-
#[derive(Debug, FromQueryResult, Deserialize, Serialize)]
77-
pub struct Recreation {
78-
community_centers: Option<f64>,
79-
parks: Option<f64>,
80-
recreation_trails: Option<f64>,
81-
recreation_score: Option<f64>,
82-
}
83-
84-
#[derive(Debug, FromQueryResult, Deserialize, Serialize)]
85-
pub struct Opportunity {
86-
employment: Option<f64>,
87-
higher_education: Option<f64>,
88-
k12_education: Option<f64>,
89-
opportunity_score: Option<f64>,
90-
technical_vocational_college: Option<f64>,
91-
}
92-
93-
#[derive(Debug, FromQueryResult, Deserialize, Serialize)]
94-
pub struct CoreServices {
95-
dentists: Option<f64>,
96-
doctors: Option<f64>,
97-
grocery: Option<f64>,
98-
hospitals: Option<f64>,
99-
pharmacies: Option<f64>,
100-
coreservices_score: Option<f64>,
101-
social_services: Option<f64>,
102-
}
103-
104-
#[derive(Debug, FromQueryResult, Deserialize, Serialize)]
105-
pub struct People {
106-
people: Option<f64>,
107-
}
108-
109-
#[derive(Debug, FromQueryResult, Deserialize, Serialize)]
110-
pub struct Retail {
111-
retail: Option<f64>,
112-
}
113-
114-
#[derive(Debug, FromQueryResult, Deserialize, Serialize)]
115-
pub struct Transit {
116-
transit: Option<f64>,
117-
}
118-
119-
// #[derive(Debug)]
120-
// pub enum BNAComponentValue {
121-
// All(Bna),
122-
// Summary(Summary),
123-
// Infrastructure(Summary, Option<Infrastructure>),
124-
// Recreation(Summary, Option<Recreation>),
125-
// Opportunity(Summary, Option<Opportunity>),
126-
// CoreServices(Summary, Option<CoreServices>),
127-
// People(Summary, Option<People>),
128-
// Retail(Summary, Option<Retail>),
129-
// Transit(Summary, Option<Transit>),
130-
// }
131-
13262
pub async fn fetch_ratings_summaries(
13363
db: &DatabaseConnection,
13464
page: u64,

lambdas/src/core/resource/schema.rs

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -257,44 +257,3 @@ pub(crate) struct PaginationParams {
257257
#[param(minimum = 1, maximum = 65536, example = 5)]
258258
page: Option<u64>,
259259
}
260-
261-
#[derive(ToSchema, Serialize, Deserialize)]
262-
pub(crate) enum BikeLaneType {
263-
BufferedLane,
264-
Lane,
265-
Path,
266-
Sharrow,
267-
Track,
268-
}
269-
270-
impl FromStr for BikeLaneType {
271-
type Err = serde_plain::Error;
272-
273-
fn from_str(s: &str) -> Result<Self, Self::Err> {
274-
serde_plain::from_str::<Self>(s)
275-
}
276-
}
277-
278-
impl From<String> for BikeLaneType {
279-
fn from(value: String) -> Self {
280-
BikeLaneType::from_str(value.as_str()).expect("cannot serialize value")
281-
}
282-
}
283-
284-
impl Display for BikeLaneType {
285-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
286-
let value = serde_plain::to_string(&self).expect("cannot serialize value");
287-
write!(f, "{value}")
288-
}
289-
}
290-
impl From<entity::wrappers::BikeLaneType> for BikeLaneType {
291-
fn from(value: entity::wrappers::BikeLaneType) -> Self {
292-
match value {
293-
entity::wrappers::BikeLaneType::BufferedLane => BikeLaneType::BufferedLane,
294-
entity::wrappers::BikeLaneType::Lane => BikeLaneType::Lane,
295-
entity::wrappers::BikeLaneType::Path => BikeLaneType::Path,
296-
entity::wrappers::BikeLaneType::Sharrow => BikeLaneType::Sharrow,
297-
entity::wrappers::BikeLaneType::Track => BikeLaneType::Track,
298-
}
299-
}
300-
}

0 commit comments

Comments
 (0)