Fix some clippy warnings.
This commit is contained in:
parent
f27ed9b78e
commit
ca912afd7c
@ -122,7 +122,7 @@ fn find_camera(
|
||||
exif: &ExifData,
|
||||
) -> Result<Option<Camera>, Error> {
|
||||
if let Some((make, model)) = exif.camera() {
|
||||
let cam = Camera::get_or_create(db, &make, &model)?;
|
||||
let cam = Camera::get_or_create(db, make, model)?;
|
||||
return Ok(Some(cam));
|
||||
}
|
||||
Ok(None)
|
||||
|
@ -80,7 +80,7 @@ impl OverpassOpt {
|
||||
)
|
||||
.optional()
|
||||
.map_err(|e| Error::Db(image, e))?
|
||||
.ok_or_else(|| Error::NoPosition(image))?;
|
||||
.ok_or(Error::NoPosition(image))?;
|
||||
debug!("Should get places for #{} at {:?}", image, coord);
|
||||
let data = Client::new()
|
||||
.post(&self.overpass_url)
|
||||
|
@ -63,15 +63,15 @@ impl PhotosDir {
|
||||
}
|
||||
|
||||
fn load_meta(path: &Path) -> Option<ExifData> {
|
||||
if let Ok(mut exif) = ExifData::read_from(&path) {
|
||||
if let Ok(mut exif) = ExifData::read_from(path) {
|
||||
if exif.width.is_none() || exif.height.is_none() {
|
||||
if let Ok((width, height)) = actual_image_size(&path) {
|
||||
if let Ok((width, height)) = actual_image_size(path) {
|
||||
exif.width = Some(width);
|
||||
exif.height = Some(height);
|
||||
}
|
||||
}
|
||||
Some(exif)
|
||||
} else if let Ok((width, height)) = actual_image_size(&path) {
|
||||
} else if let Ok((width, height)) = actual_image_size(path) {
|
||||
let mut meta = ExifData::default();
|
||||
meta.width = Some(width);
|
||||
meta.height = Some(height);
|
||||
|
@ -69,7 +69,7 @@ impl GlobalContext {
|
||||
}
|
||||
|
||||
fn verify_key(&self, jwtstr: &str) -> Result<String, String> {
|
||||
let token = Token::<Header, ()>::parse(&jwtstr)
|
||||
let token = Token::<Header, ()>::parse(jwtstr)
|
||||
.map_err(|e| format!("Bad jwt token: {:?}", e))?;
|
||||
|
||||
if !verify_token(&token, self.jwt_secret.as_ref())? {
|
||||
|
@ -69,7 +69,7 @@ pub struct Args {
|
||||
|
||||
pub async fn run(args: &Args) -> Result<(), Error> {
|
||||
if let Some(pidfile) = &args.pidfile {
|
||||
handle_pid_file(&pidfile, args.replace).unwrap()
|
||||
handle_pid_file(pidfile, args.replace).unwrap()
|
||||
}
|
||||
let session_filter = create_session_filter(args);
|
||||
let s = move || session_filter.clone();
|
||||
|
@ -7,9 +7,9 @@ use diesel::pg::{Pg, PgConnection};
|
||||
use diesel::prelude::*;
|
||||
use log::{debug, info, warn};
|
||||
|
||||
pub fn links_by_time<'a>(
|
||||
pub fn links_by_time(
|
||||
context: &Context,
|
||||
photos: photos::BoxedQuery<'a, Pg>,
|
||||
photos: photos::BoxedQuery<'_, Pg>,
|
||||
range: ImgRange,
|
||||
with_date: bool,
|
||||
) -> (Vec<PhotoLink>, Vec<(Coord, i32)>) {
|
||||
@ -42,7 +42,7 @@ pub fn split_to_group_links(
|
||||
path: &UrlString,
|
||||
with_date: bool,
|
||||
) -> Vec<PhotoLink> {
|
||||
if let Some(groups) = split_to_groups(&photos) {
|
||||
if let Some(groups) = split_to_groups(photos) {
|
||||
groups
|
||||
.iter()
|
||||
.map(|g| PhotoLink::for_group(g, path.clone(), with_date))
|
||||
@ -91,8 +91,8 @@ fn find_largest(groups: &[&[Photo]]) -> usize {
|
||||
let mut found = 0;
|
||||
let mut largest = 0.0;
|
||||
for (i, g) in groups.iter().enumerate() {
|
||||
let time = 1 + g.first().map(|p| timestamp(p)).unwrap_or(0)
|
||||
- g.last().map(|p| timestamp(p)).unwrap_or(0);
|
||||
let time = 1 + g.first().map(timestamp).unwrap_or(0)
|
||||
- g.last().map(timestamp).unwrap_or(0);
|
||||
let score = (g.len() as f64).powi(3) * (time as f64);
|
||||
if score > largest {
|
||||
largest = score;
|
||||
|
Loading…
Reference in New Issue
Block a user