Merge pull request #876 from gwenn/clippy

Fix clippy warnings
This commit is contained in:
gwenn 2021-01-08 21:33:24 +01:00 committed by GitHub
commit 47134e9527
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View File

@ -298,15 +298,15 @@ fn is_identifier(s: &str) -> bool {
} }
fn is_identifier_start(c: char) -> bool { fn is_identifier_start(c: char) -> bool {
(c >= 'A' && c <= 'Z') || c == '_' || (c >= 'a' && c <= 'z') || c > '\x7F' ('A'..='Z').contains(&c) || c == '_' || ('a'..='z').contains(&c) || c > '\x7F'
} }
fn is_identifier_continue(c: char) -> bool { fn is_identifier_continue(c: char) -> bool {
c == '$' c == '$'
|| (c >= '0' && c <= '9') || ('0'..='9').contains(&c)
|| (c >= 'A' && c <= 'Z') || ('A'..='Z').contains(&c)
|| c == '_' || c == '_'
|| (c >= 'a' && c <= 'z') || ('a'..='z').contains(&c)
|| c > '\x7F' || c > '\x7F'
} }

View File

@ -157,7 +157,7 @@ impl ArrayTabCursor<'_> {
unsafe impl VTabCursor for ArrayTabCursor<'_> { unsafe impl VTabCursor for ArrayTabCursor<'_> {
fn filter(&mut self, idx_num: c_int, _idx_str: Option<&str>, args: &Values<'_>) -> Result<()> { fn filter(&mut self, idx_num: c_int, _idx_str: Option<&str>, args: &Values<'_>) -> Result<()> {
if idx_num > 0 { if idx_num > 0 {
self.ptr = args.get_array(0)?; self.ptr = args.get_array(0);
} else { } else {
self.ptr = None; self.ptr = None;
} }

View File

@ -571,19 +571,19 @@ impl Values<'_> {
// `sqlite3_value_type` returns `SQLITE_NULL` for pointer. // `sqlite3_value_type` returns `SQLITE_NULL` for pointer.
// So it seems not possible to enhance `ValueRef::from_value`. // So it seems not possible to enhance `ValueRef::from_value`.
#[cfg(feature = "array")] #[cfg(feature = "array")]
fn get_array(&self, idx: usize) -> Result<Option<array::Array>> { fn get_array(&self, idx: usize) -> Option<array::Array> {
use crate::types::Value; use crate::types::Value;
let arg = self.args[idx]; let arg = self.args[idx];
let ptr = unsafe { ffi::sqlite3_value_pointer(arg, array::ARRAY_TYPE) }; let ptr = unsafe { ffi::sqlite3_value_pointer(arg, array::ARRAY_TYPE) };
if ptr.is_null() { if ptr.is_null() {
Ok(None) None
} else { } else {
Ok(Some(unsafe { Some(unsafe {
let rc = array::Array::from_raw(ptr as *const Vec<Value>); let rc = array::Array::from_raw(ptr as *const Vec<Value>);
let array = rc.clone(); let array = rc.clone();
array::Array::into_raw(rc); // don't consume it array::Array::into_raw(rc); // don't consume it
array array
})) })
} }
} }