diff --git a/src/completion/default.rs b/src/completion/default.rs index 6f674f3b..11062d7b 100644 --- a/src/completion/default.rs +++ b/src/completion/default.rs @@ -359,7 +359,7 @@ mod tests { let mut completions = DefaultCompleter::default(); completions.insert( - vec!["nushell", "null", "number"] + ["nushell", "null", "number"] .iter() .map(|s| s.to_string()) .collect(), @@ -367,7 +367,7 @@ mod tests { assert_eq!( completions.complete("n", 3), - vec![ + [ Suggestion { value: "null".into(), description: None, diff --git a/src/history/sqlite_backed.rs b/src/history/sqlite_backed.rs index 8247e314..a19438e9 100644 --- a/src/history/sqlite_backed.rs +++ b/src/history/sqlite_backed.rs @@ -264,15 +264,15 @@ impl SqliteBackedHistory { SearchDirection::Forward => (true, "asc"), SearchDirection::Backward => (false, "desc"), }; - let mut wheres: Vec<&str> = vec![]; - let mut params: BoxedNamedParams = vec![]; + let mut wheres = Vec::new(); + let mut params: BoxedNamedParams = Vec::new(); if let Some(start) = query.start_time { wheres.push(if is_asc { "timestamp_start > :start_time" } else { "timestamp_start < :start_time" }); - params.push((":start_time", Box::new(start.timestamp_millis()))) + params.push((":start_time", Box::new(start.timestamp_millis()))); } if let Some(end) = query.end_time { wheres.push(if is_asc { @@ -288,7 +288,7 @@ impl SqliteBackedHistory { } else { "id < :start_id" }); - params.push((":start_id", Box::new(start.0))) + params.push((":start_id", Box::new(start.0))); } if let Some(end) = query.end_id { wheres.push(if is_asc { @@ -349,10 +349,11 @@ impl SqliteBackedHistory { wheres = "true".to_string(); } let query = format!( - "select {select_expression} from history - where - {wheres} - order by id {asc} {limit}" + "SELECT {select_expression} \ + FROM history \ + WHERE ({wheres}) \ + ORDER BY id {asc} \ + {limit}" ); (query, params) }