Skip to content

Commit

Permalink
Apply clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
erik committed Oct 19, 2023
1 parent b826295 commit 6b328a2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
24 changes: 12 additions & 12 deletions projects/panamint/src/geo/flat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl Ruler {
/// Return a new line created by interpolating points along the
/// original line at equal intervals.
pub fn resample_line(&self, geo: &[Point], meters: f32) -> Vec<Point> {
assert!(geo.len() > 0);
assert!(!geo.is_empty());

let mut resampled = vec![geo[0]];

Expand Down Expand Up @@ -192,17 +192,17 @@ mod tests {
#[test]
fn haversine_equivalence() {
let base = &Point {
lng: 96.920341,
lat: 32.838261,
lng: 96.920_34,
lat: 32.838_26,
};

let points: Vec<Point> = [
(96.920341, 32.838261),
(96.920421, 32.838295),
(96.920421, 32.838295),
(96.920536, 32.838297),
(96.920684, 32.838293),
(96.920818, 32.838342),
(96.920_34, 32.838_26),
(96.920_42, 32.838295),
(96.920_42, 32.838295),
(96.920_53, 32.838_3),
(96.920684, 32.838_29),
(96.920818, 32.838_34),
]
.into_iter()
.map(|(lng, lat)| Point { lng, lat })
Expand Down Expand Up @@ -237,17 +237,17 @@ mod tests {

let pt = Point {
lat: 38.882017,
lng: -77.034076,
lng: -77.034_07,
};

let line = (
Point {
lat: 38.878605,
lng: -77.031669,
lng: -77.031_67,
},
Point {
lat: 38.881946,
lng: -77.029609,
lng: -77.029_61,
},
);

Expand Down
1 change: 0 additions & 1 deletion projects/panamint/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ pub fn route_api_brouter(
lat: lat.parse::<f32>().ok()?,
})
})
.into_iter()
.collect::<Option<Vec<Point>>>();

let (from, to) = match coords {
Expand Down
3 changes: 1 addition & 2 deletions projects/panamint/src/profile/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ fn parse_tag_expr(pairs: pest::iterators::Pairs<Rule>) -> Vec<TagPattern<String>
let key = parse_as_str(node.next().unwrap());
let op = node.next().unwrap();
let patterns = node
.into_iter()
.map(|x| parse_as_str(x).into())
.collect::<Vec<_>>();

Expand Down Expand Up @@ -275,7 +274,7 @@ profile "kitchen sink" {
}
"#;

let parsed = Grammar::parse(Rule::top_level, &input).expect("parse okay");
let parsed = Grammar::parse(Rule::top_level, input).expect("parse okay");

for pair in parsed {
println!("---> {:?}", pair);
Expand Down
6 changes: 3 additions & 3 deletions projects/panamint/src/profile/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ impl<'a> Builder<'a> {

let arg_range = match ty.arity() {
Arity::Unary => 1..=1,
Arity::Variadic => (1..=usize::MAX),
Arity::Variadic => 1..=usize::MAX,
};

if !arg_range.contains(&block.body.len()) {
Expand Down Expand Up @@ -667,7 +667,7 @@ mod tests {
tag_dict.insert(tag.into());
}

Runtime::from_source(&input, &tag_dict).expect("create runtime");
Runtime::from_source(input, &tag_dict).expect("create runtime");
}

#[test]
Expand All @@ -690,7 +690,7 @@ profile "test" {
tag_dict.insert(tag.into());
}

let runtime = Runtime::from_source(&input, &tag_dict).expect("create runtime");
let runtime = Runtime::from_source(input, &tag_dict).expect("create runtime");

let expected = vec![
Value::Number(1.0),
Expand Down

0 comments on commit 6b328a2

Please sign in to comment.