Avoid rust-analyzer bug in InnerConnection::new (#686)

This is a workaround for a false error rust-analyzer gives in
InnerConnection::new. I'm guessing it's because it does some weird
feature stuff. It doesn't change any semantics, but makes working in
`rusqlite` much nicer when using rust-analyzer.
This commit is contained in:
Thom Chiovoloni 2020-04-07 08:58:41 -07:00 committed by GitHub
parent 5ef73f6c8c
commit c0df911946
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,24 +36,16 @@ pub struct InnerConnection {
} }
impl InnerConnection { impl InnerConnection {
#[cfg(not(feature = "hooks"))]
#[allow(clippy::mutex_atomic)] #[allow(clippy::mutex_atomic)]
pub fn new(db: *mut ffi::sqlite3, owned: bool) -> InnerConnection { pub fn new(db: *mut ffi::sqlite3, owned: bool) -> InnerConnection {
InnerConnection { InnerConnection {
db, db,
interrupt_lock: Arc::new(Mutex::new(db)), interrupt_lock: Arc::new(Mutex::new(db)),
owned,
}
}
#[cfg(feature = "hooks")] #[cfg(feature = "hooks")]
#[allow(clippy::mutex_atomic)]
pub fn new(db: *mut ffi::sqlite3, owned: bool) -> InnerConnection {
InnerConnection {
db,
interrupt_lock: Arc::new(Mutex::new(db)),
free_commit_hook: None, free_commit_hook: None,
#[cfg(feature = "hooks")]
free_rollback_hook: None, free_rollback_hook: None,
#[cfg(feature = "hooks")]
free_update_hook: None, free_update_hook: None,
owned, owned,
} }