code cosmetics, lints
useless format! in tests use raw strings where appropriate
This commit is contained in:
parent
39272a5cb0
commit
fd72034571
7 changed files with 17 additions and 20 deletions
|
@ -299,7 +299,7 @@ impl Query {
|
||||||
if let EntryValue::Number(n) = v {
|
if let EntryValue::Number(n) = v {
|
||||||
Ok(*n)
|
Ok(*n)
|
||||||
} else {
|
} else {
|
||||||
Err(anyhow!("IN queries fidj oisdjfo isdjfoi jsdoifj sodijf oisdjf oij must not combine numeric and string values! ({v} is not a number)"))
|
Err(anyhow!("IN queries must not combine numeric and string values! ({v} is not a number)"))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect::<Result<Vec<f64>>>()?,
|
.collect::<Result<Vec<f64>>>()?,
|
||||||
|
|
|
@ -52,7 +52,7 @@ impl ConnectionOptions {
|
||||||
conn.execute(&format!("PRAGMA busy_timeout = {};", duration.as_millis()))?;
|
conn.execute(&format!("PRAGMA busy_timeout = {};", duration.as_millis()))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("Setting \"synchronous\" to NORMAL");
|
debug!(r#"Setting "synchronous" to NORMAL"#);
|
||||||
conn.execute("PRAGMA synchronous = NORMAL;")?;
|
conn.execute("PRAGMA synchronous = NORMAL;")?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -196,7 +196,7 @@ impl UpEndConnection {
|
||||||
.filter(dsl::key.eq(key))
|
.filter(dsl::key.eq(key))
|
||||||
.load::<models::MetaValue>(&self.conn)?
|
.load::<models::MetaValue>(&self.conn)?
|
||||||
.first()
|
.first()
|
||||||
.ok_or(anyhow!("No META \"{key}\" value found."))
|
.ok_or(anyhow!(r#"No META "{key}" value found."#))
|
||||||
.map(|mv| mv.value.clone())
|
.map(|mv| mv.value.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,9 +474,7 @@ mod test {
|
||||||
let result = connection.query(query).unwrap();
|
let result = connection.query(query).unwrap();
|
||||||
assert_eq!(result.len(), 4);
|
assert_eq!(result.len(), 4);
|
||||||
|
|
||||||
let query = format!(r#"(matches ? (in "FLAVOUR" "CHARGE") ?)"#)
|
let query = r#"(matches ? (in "FLAVOUR" "CHARGE") ?)"#.parse().unwrap();
|
||||||
.parse()
|
|
||||||
.unwrap();
|
|
||||||
let result = connection.query(query).unwrap();
|
let result = connection.query(query).unwrap();
|
||||||
assert_eq!(result.len(), 2);
|
assert_eq!(result.len(), 2);
|
||||||
|
|
||||||
|
@ -492,10 +490,9 @@ mod test {
|
||||||
let result = connection.query(query).unwrap();
|
let result = connection.query(query).unwrap();
|
||||||
assert_eq!(result.len(), 1);
|
assert_eq!(result.len(), 1);
|
||||||
|
|
||||||
let query =
|
let query = r#"(or (matches ? ? (contains "OOBA")) (matches ? (contains "HARGE") ?) )"#
|
||||||
format!(r#"(or (matches ? ? (contains "OOBA")) (matches ? (contains "HARGE") ?) )"#)
|
.parse()
|
||||||
.parse()
|
.unwrap();
|
||||||
.unwrap();
|
|
||||||
let result = connection.query(query).unwrap();
|
let result = connection.query(query).unwrap();
|
||||||
assert_eq!(result.len(), 2);
|
assert_eq!(result.len(), 2);
|
||||||
|
|
||||||
|
@ -507,11 +504,11 @@ mod test {
|
||||||
assert_eq!(result.len(), 1);
|
assert_eq!(result.len(), 1);
|
||||||
|
|
||||||
// let query = format!(
|
// let query = format!(
|
||||||
// r#"(and
|
// r#"(and
|
||||||
// (or
|
// (or
|
||||||
// (matches ? ? (contains "OOBA"))
|
// (matches ? ? (contains "OOBA"))
|
||||||
// (matches ? (contains "HARGE") ?)
|
// (matches ? (contains "HARGE") ?)
|
||||||
// )
|
// )
|
||||||
// (not (matches ? "{LABEL_ATTR}" ?))
|
// (not (matches ? "{LABEL_ATTR}" ?))
|
||||||
// )"#
|
// )"#
|
||||||
// )
|
// )
|
||||||
|
|
|
@ -40,7 +40,7 @@ impl Extractor for ID3Extractor {
|
||||||
let mut job_handle = job_container.add_job(
|
let mut job_handle = job_container.add_job(
|
||||||
None,
|
None,
|
||||||
&format!(
|
&format!(
|
||||||
"Getting ID3 info from \"{:}\"",
|
r#"Getting ID3 info from "{:}""#,
|
||||||
file.path
|
file.path
|
||||||
.components()
|
.components()
|
||||||
.last()
|
.last()
|
||||||
|
|
|
@ -43,7 +43,7 @@ impl Extractor for ExifExtractor {
|
||||||
let mut job_handle = job_container.add_job(
|
let mut job_handle = job_container.add_job(
|
||||||
None,
|
None,
|
||||||
&format!(
|
&format!(
|
||||||
"Getting EXIF info from \"{:}\"",
|
r#"Getting EXIF info from "{:}""#,
|
||||||
file.path
|
file.path
|
||||||
.components()
|
.components()
|
||||||
.last()
|
.last()
|
||||||
|
|
|
@ -49,7 +49,7 @@ fn main() -> Result<()> {
|
||||||
Arg::with_name("DB_PATH")
|
Arg::with_name("DB_PATH")
|
||||||
.long("db-path")
|
.long("db-path")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("path to sqlite db file (\"$VAULT_PATH/.upend\" by default)"),
|
.help(r#"path to sqlite db file ("$VAULT_PATH/.upend" by default)"#),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("NO_BROWSER")
|
Arg::with_name("NO_BROWSER")
|
||||||
|
|
|
@ -686,7 +686,7 @@ pub async fn list_hier(
|
||||||
.finish())
|
.finish())
|
||||||
} else {
|
} else {
|
||||||
let upath: UHierPath = path.into_inner().parse().map_err(ErrorBadRequest)?;
|
let upath: UHierPath = path.into_inner().parse().map_err(ErrorBadRequest)?;
|
||||||
trace!("Listing path \"{}\"", upath);
|
trace!(r#"Listing path "{}""#, upath);
|
||||||
|
|
||||||
// todo: 500 if actual error occurs
|
// todo: 500 if actual error occurs
|
||||||
let path = web::block(move || resolve_path(&connection, &upath, false))
|
let path = web::block(move || resolve_path(&connection, &upath, false))
|
||||||
|
|
|
@ -77,7 +77,7 @@ impl JobContainer {
|
||||||
.any(|(_, j)| j.state == JobState::InProgress && j.job_type == job.job_type)
|
.any(|(_, j)| j.state == JobState::InProgress && j.job_type == job.job_type)
|
||||||
{
|
{
|
||||||
return Err(JobInProgessError(format!(
|
return Err(JobInProgessError(format!(
|
||||||
"Job of type \"{}\" currently in progress.",
|
r#"Job of type "{}" currently in progress."#,
|
||||||
job_type
|
job_type
|
||||||
))
|
))
|
||||||
.into());
|
.into());
|
||||||
|
|
Loading…
Reference in a new issue