code cosmetics, lints

useless format! in tests
use raw strings where appropriate
feat/vaults
Tomáš Mládek 2022-03-28 20:06:00 +02:00
parent 39272a5cb0
commit fd72034571
No known key found for this signature in database
GPG Key ID: 65E225C8B3E2ED8A
7 changed files with 17 additions and 20 deletions

View File

@ -299,7 +299,7 @@ impl Query {
if let EntryValue::Number(n) = v {
Ok(*n)
} 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>>>()?,

View File

@ -52,7 +52,7 @@ impl ConnectionOptions {
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;")?;
Ok(())
@ -196,7 +196,7 @@ impl UpEndConnection {
.filter(dsl::key.eq(key))
.load::<models::MetaValue>(&self.conn)?
.first()
.ok_or(anyhow!("No META \"{key}\" value found."))
.ok_or(anyhow!(r#"No META "{key}" value found."#))
.map(|mv| mv.value.clone())
}
@ -474,9 +474,7 @@ mod test {
let result = connection.query(query).unwrap();
assert_eq!(result.len(), 4);
let query = format!(r#"(matches ? (in "FLAVOUR" "CHARGE") ?)"#)
.parse()
.unwrap();
let query = r#"(matches ? (in "FLAVOUR" "CHARGE") ?)"#.parse().unwrap();
let result = connection.query(query).unwrap();
assert_eq!(result.len(), 2);
@ -492,10 +490,9 @@ mod test {
let result = connection.query(query).unwrap();
assert_eq!(result.len(), 1);
let query =
format!(r#"(or (matches ? ? (contains "OOBA")) (matches ? (contains "HARGE") ?) )"#)
.parse()
.unwrap();
let query = r#"(or (matches ? ? (contains "OOBA")) (matches ? (contains "HARGE") ?) )"#
.parse()
.unwrap();
let result = connection.query(query).unwrap();
assert_eq!(result.len(), 2);
@ -507,11 +504,11 @@ mod test {
assert_eq!(result.len(), 1);
// let query = format!(
// r#"(and
// (or
// (matches ? ? (contains "OOBA"))
// (matches ? (contains "HARGE") ?)
// )
// r#"(and
// (or
// (matches ? ? (contains "OOBA"))
// (matches ? (contains "HARGE") ?)
// )
// (not (matches ? "{LABEL_ATTR}" ?))
// )"#
// )

View File

@ -40,7 +40,7 @@ impl Extractor for ID3Extractor {
let mut job_handle = job_container.add_job(
None,
&format!(
"Getting ID3 info from \"{:}\"",
r#"Getting ID3 info from "{:}""#,
file.path
.components()
.last()

View File

@ -43,7 +43,7 @@ impl Extractor for ExifExtractor {
let mut job_handle = job_container.add_job(
None,
&format!(
"Getting EXIF info from \"{:}\"",
r#"Getting EXIF info from "{:}""#,
file.path
.components()
.last()

View File

@ -49,7 +49,7 @@ fn main() -> Result<()> {
Arg::with_name("DB_PATH")
.long("db-path")
.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::with_name("NO_BROWSER")

View File

@ -686,7 +686,7 @@ pub async fn list_hier(
.finish())
} else {
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
let path = web::block(move || resolve_path(&connection, &upath, false))

View File

@ -77,7 +77,7 @@ impl JobContainer {
.any(|(_, j)| j.state == JobState::InProgress && j.job_type == job.job_type)
{
return Err(JobInProgessError(format!(
"Job of type \"{}\" currently in progress.",
r#"Job of type "{}" currently in progress."#,
job_type
))
.into());