mirror of
				https://github.com/isar/rusqlite.git
				synced 2025-10-31 22:08:55 +08:00 
			
		
		
		
	Don't implement Into<RawStatement> for Statement
This commit is contained in:
		
				
					committed by
					
						 Thom Chiovoloni
						Thom Chiovoloni
					
				
			
			
				
	
			
			
			
						parent
						
							6b4f207dc1
						
					
				
				
					commit
					f7a573e44a
				
			| @@ -84,7 +84,7 @@ impl Drop for CachedStatement<'_> { | |||||||
|     #[allow(unused_must_use)] |     #[allow(unused_must_use)] | ||||||
|     fn drop(&mut self) { |     fn drop(&mut self) { | ||||||
|         if let Some(stmt) = self.stmt.take() { |         if let Some(stmt) = self.stmt.take() { | ||||||
|             self.cache.cache_stmt(stmt.into()); |             self.cache.cache_stmt(unsafe { stmt.into_raw() }); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -702,11 +702,12 @@ impl Statement<'_> { | |||||||
|     pub(crate) fn check_no_tail(&self) -> Result<()> { |     pub(crate) fn check_no_tail(&self) -> Result<()> { | ||||||
|         Ok(()) |         Ok(()) | ||||||
|     } |     } | ||||||
| } |  | ||||||
|  |  | ||||||
| impl Into<RawStatement> for Statement<'_> { |     /// Safety: This is unsafe, because using `sqlite3_stmt` after the | ||||||
|     fn into(mut self) -> RawStatement { |     /// connection has closed is illegal, but `RawStatement` does not enforce | ||||||
|         let mut stmt = unsafe { RawStatement::new(ptr::null_mut(), false) }; |     /// this, as it loses our protective `'conn` lifetime bound. | ||||||
|  |     pub(crate) unsafe fn into_raw(mut self) -> RawStatement { | ||||||
|  |         let mut stmt = RawStatement::new(ptr::null_mut(), false); | ||||||
|         mem::swap(&mut stmt, &mut self.stmt); |         mem::swap(&mut stmt, &mut self.stmt); | ||||||
|         stmt |         stmt | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user