Prepare a 2.1.4 release
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bfa5fc0..21ad992 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,10 @@
 
 ## Unreleased
 
+## [2.1.4] 2023-11-14
+
+* Update `libsqlite3-sys` to allow version 0.27 as well
+
 ## [2.1.3] 2023-10-05
 
 * Increased accidently decreased limit around element count in  `DISTINCT ON` and `ORDER BY` clauses again as that broke existing code
@@ -2058,3 +2062,4 @@
 [2.1.1]: https://github.com/diesel-rs/diesel/compare/v2.1.0...v2.1.1
 [2.1.2]: https://github.com/diesel-rs/diesel/compare/v2.1.1...v2.1.2
 [2.1.3]: https://github.com/diesel-rs/diesel/compare/v2.1.2...v2.1.3
+[2.1.4]: https://github.com/diesel-rs/diesel/compare/v2.1.3...v2.1.4
diff --git a/diesel/Cargo.toml b/diesel/Cargo.toml
index 465688d..4939e9c 100644
--- a/diesel/Cargo.toml
+++ b/diesel/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "diesel"
-version = "2.1.3"
+version = "2.1.4"
 license = "MIT OR Apache-2.0"
 description = "A safe, extensible ORM and Query Builder for PostgreSQL, SQLite, and MySQL"
 readme = "README.md"
@@ -16,7 +16,7 @@
 byteorder = { version = "1.0", optional = true }
 chrono = { version = "0.4.20", optional = true, default-features = false, features = ["clock", "std"] }
 libc = { version = "0.2.0", optional = true }
-libsqlite3-sys = { version = ">=0.17.2, <0.27.0", optional = true, features = ["bundled_bindings"] }
+libsqlite3-sys = { version = ">=0.17.2, <0.28.0", optional = true, features = ["bundled_bindings"] }
 mysqlclient-sys = { version = "0.2.5", optional = true }
 pq-sys = { version = "0.4.0", optional = true }
 quickcheck = { version = "1.0.3", optional = true }
diff --git a/diesel/src/connection/mod.rs b/diesel/src/connection/mod.rs
index 79eaf28..e8189b2 100644
--- a/diesel/src/connection/mod.rs
+++ b/diesel/src/connection/mod.rs
@@ -547,6 +547,7 @@
 
     // These impls are only there for backward compatibility reasons
     // Remove them on the next breaking release
+    #[allow(unreachable_pub)] // must be pub for the type def using this trait
     #[cfg(all(feature = "with-deprecated", not(feature = "without-deprecated")))]
     pub trait ConnectionHelperType<DB, B>: super::LoadConnection<B, Backend = DB> {
         type Cursor<'conn, 'query>
diff --git a/diesel/src/macros/mod.rs b/diesel/src/macros/mod.rs
index c1c3ad2..79d0285 100644
--- a/diesel/src/macros/mod.rs
+++ b/diesel/src/macros/mod.rs
@@ -4,7 +4,7 @@
         allow(deprecated)
     )]
     // This is a false positive, we reexport it later
-    #[allow(unreachable_pub)]
+    #[allow(unreachable_pub, unused_imports)]
     #[doc(inline)]
     pub use crate::{
         allow_columns_to_appear_in_same_group_by_clause, allow_tables_to_appear_in_same_query,
diff --git a/diesel/src/pg/types/date_and_time/std_time.rs b/diesel/src/pg/types/date_and_time/std_time.rs
index a25ec6c..b019c59 100644
--- a/diesel/src/pg/types/date_and_time/std_time.rs
+++ b/diesel/src/pg/types/date_and_time/std_time.rs
@@ -45,7 +45,6 @@
 const NANO_PER_USEC: u32 = 1_000;
 
 fn usecs_to_duration(usecs_passed: u64) -> Duration {
-    let usecs_passed = usecs_passed;
     let seconds = usecs_passed / USEC_PER_SEC;
     let subsecond_usecs = usecs_passed % USEC_PER_SEC;
     let subseconds = subsecond_usecs as u32 * NANO_PER_USEC;
diff --git a/diesel/src/query_builder/distinct_clause.rs b/diesel/src/query_builder/distinct_clause.rs
index 35bcb3b..a772afc 100644
--- a/diesel/src/query_builder/distinct_clause.rs
+++ b/diesel/src/query_builder/distinct_clause.rs
@@ -31,6 +31,6 @@
 impl<O> ValidOrderingForDistinct<DistinctClause> for O {}
 
 // This is rexported from another location
-#[allow(unreachable_pub)]
+#[allow(unreachable_pub, unused_imports)]
 #[cfg(feature = "postgres_backend")]
 pub use crate::pg::DistinctOnClause;
diff --git a/diesel/src/row.rs b/diesel/src/row.rs
index a48c697..daf3f97 100644
--- a/diesel/src/row.rs
+++ b/diesel/src/row.rs
@@ -265,6 +265,7 @@
     // These impls are only there for backward compatibility reasons
     // Remove them on the next breaking release
     #[cfg(all(feature = "with-deprecated", not(feature = "without-deprecated")))]
+    #[allow(unreachable_pub)]
     pub trait RowLifetimeHelper<DB>: for<'a> super::Row<'a, DB>
     where
         DB: Backend,
diff --git a/diesel/src/sqlite/connection/statement_iterator.rs b/diesel/src/sqlite/connection/statement_iterator.rs
index f8b09c2..c73cb7f 100644
--- a/diesel/src/sqlite/connection/statement_iterator.rs
+++ b/diesel/src/sqlite/connection/statement_iterator.rs
@@ -51,13 +51,10 @@
             match res {
                 Err(e) => Some(Err(e)),
                 Ok(false) => None,
-                Ok(true) => {
-                    let field_count = field_count;
-                    Some(Ok(SqliteRow {
-                        inner: Rc::clone(outer_last_row),
-                        field_count,
-                    }))
-                }
+                Ok(true) => Some(Ok(SqliteRow {
+                    inner: Rc::clone(outer_last_row),
+                    field_count,
+                })),
             }
         } else {
             // any other state than `PrivateSqliteRow::Direct` is invalid here
diff --git a/diesel/src/sqlite/connection/stmt.rs b/diesel/src/sqlite/connection/stmt.rs
index ffd8ed0..1919863 100644
--- a/diesel/src/sqlite/connection/stmt.rs
+++ b/diesel/src/sqlite/connection/stmt.rs
@@ -26,6 +26,8 @@
     ) -> QueryResult<Self> {
         let mut stmt = ptr::null_mut();
         let mut unused_portion = ptr::null();
+        // the cast for `ffi::SQLITE_PREPARE_PERSISTENT` is required for old libsqlite3-sys versions
+        #[allow(clippy::unnecessary_cast)]
         let prepare_result = unsafe {
             ffi::sqlite3_prepare_v3(
                 raw_connection.internal_connection.as_ptr(),
diff --git a/diesel_cli/Cargo.toml b/diesel_cli/Cargo.toml
index e2308de..c877248 100644
--- a/diesel_cli/Cargo.toml
+++ b/diesel_cli/Cargo.toml
@@ -27,7 +27,7 @@
 serde = { version = "1.0.0", features = ["derive"] }
 toml = "0.7"
 url = { version = "2.2.2" }
-libsqlite3-sys = { version = ">=0.17.2, <0.27.0", optional = true }
+libsqlite3-sys = { version = ">=0.17.2, <0.28.0", optional = true }
 diffy = "0.3.0"
 regex = "1.0.6"
 serde_regex = "1.1"
diff --git a/diesel_cli/src/migrations/diff_schema.rs b/diesel_cli/src/migrations/diff_schema.rs
index 36e3818..b06595c 100644
--- a/diesel_cli/src/migrations/diff_schema.rs
+++ b/diesel_cli/src/migrations/diff_schema.rs
@@ -53,25 +53,25 @@
 
     let foreign_keys =
         crate::infer_schema_internals::load_foreign_key_constraints(&mut conn, None)?;
-    let foreign_key_map = foreign_keys.into_iter().fold(HashMap::new(), |mut acc, t| {
-        acc.entry(t.child_table.rust_name.clone())
-            .or_insert_with(Vec::new)
-            .push(t);
-        acc
-    });
-
-    let mut expected_fk_map =
-        tables_from_schema
-            .joinable
+    let foreign_key_map =
+        foreign_keys
             .into_iter()
-            .try_fold(HashMap::new(), |mut acc, t| {
-                t.map(|t| {
-                    acc.entry(t.child_table.to_string())
-                        .or_insert_with(Vec::new)
-                        .push(t);
-                    acc
-                })
-            })?;
+            .fold(HashMap::<_, Vec<_>>::new(), |mut acc, t| {
+                acc.entry(t.child_table.rust_name.clone())
+                    .or_default()
+                    .push(t);
+                acc
+            });
+
+    let mut expected_fk_map = tables_from_schema.joinable.into_iter().try_fold(
+        HashMap::<_, Vec<_>>::new(),
+        |mut acc, t| {
+            t.map(|t| {
+                acc.entry(t.child_table.to_string()).or_default().push(t);
+                acc
+            })
+        },
+    )?;
 
     let table_pk_key_list = tables_from_schema
         .table_decls
diff --git a/diesel_derives/src/sql_function.rs b/diesel_derives/src/sql_function.rs
index 20e2f20..9a9ed90 100644
--- a/diesel_derives/src/sql_function.rs
+++ b/diesel_derives/src/sql_function.rs
@@ -221,7 +221,7 @@
                         }
                     };
                 }
-                x if x == 1 => {
+                1 => {
                     let arg_name = arg_name[0];
                     let arg_type = arg_type[0];
 
diff --git a/diesel_tests/Cargo.toml b/diesel_tests/Cargo.toml
index e2340c9..5fdd4a5 100644
--- a/diesel_tests/Cargo.toml
+++ b/diesel_tests/Cargo.toml
@@ -21,7 +21,7 @@
 ipnetwork = ">=0.12.2, <0.21.0"
 bigdecimal = ">= 0.0.13, < 0.5.0"
 rand = "0.8.4"
-libsqlite3-sys = { version = "0.26", optional = true }
+libsqlite3-sys = { version = "0.27", optional = true }
 
 [features]
 default = []
diff --git a/diesel_tests/tests/types_roundtrip.rs b/diesel_tests/tests/types_roundtrip.rs
index 746d508..3b09824 100644
--- a/diesel_tests/tests/types_roundtrip.rs
+++ b/diesel_tests/tests/types_roundtrip.rs
@@ -3,9 +3,9 @@
 pub use quickcheck::quickcheck;
 
 pub use crate::schema::{connection_without_transaction, TestConnection};
+#[cfg(not(feature = "sqlite"))]
 pub use diesel::data_types::*;
 pub use diesel::result::Error;
-pub use diesel::serialize::ToSql;
 pub use diesel::sql_types::{HasSqlType, SingleValue, SqlType};
 pub use diesel::*;
 
diff --git a/examples/sqlite/all_about_inserts/Cargo.toml b/examples/sqlite/all_about_inserts/Cargo.toml
index 28e23b0..80f6e61 100644
--- a/examples/sqlite/all_about_inserts/Cargo.toml
+++ b/examples/sqlite/all_about_inserts/Cargo.toml
@@ -9,6 +9,7 @@
 serde = { version = "1.0.130", features = ["derive"] }
 serde_json = "1.0.68"
 chrono = { version = "0.4.20", default-features = false, features = ["clock", "std"] }
+libsqlite3-sys = { version = "0.27.0", features = ["bundled"] }
 
 [lib]
 doc = false
diff --git a/examples/sqlite/getting_started_step_1/Cargo.toml b/examples/sqlite/getting_started_step_1/Cargo.toml
index a840e22..a53a790 100644
--- a/examples/sqlite/getting_started_step_1/Cargo.toml
+++ b/examples/sqlite/getting_started_step_1/Cargo.toml
@@ -9,6 +9,7 @@
 [dependencies]
 diesel = { version = "2.1.0", path = "../../../diesel", features = ["sqlite"] }
 dotenvy = "0.15"
+libsqlite3-sys = { version = "0.27.0", features = ["bundled"] }
 
 [[bin]]
 name = "show_posts"
diff --git a/examples/sqlite/getting_started_step_2/Cargo.toml b/examples/sqlite/getting_started_step_2/Cargo.toml
index b5e2522..ad212b0 100644
--- a/examples/sqlite/getting_started_step_2/Cargo.toml
+++ b/examples/sqlite/getting_started_step_2/Cargo.toml
@@ -8,6 +8,7 @@
 [dependencies]
 diesel = { version = "2.1.0", path = "../../../diesel", features = ["sqlite", "returning_clauses_for_sqlite_3_35"] }
 dotenvy = "0.15"
+libsqlite3-sys = { version = "0.27.0", features = ["bundled"] }
 
 [[bin]]
 name = "show_posts"
diff --git a/examples/sqlite/getting_started_step_3/Cargo.toml b/examples/sqlite/getting_started_step_3/Cargo.toml
index 3da78bf..44be61c 100644
--- a/examples/sqlite/getting_started_step_3/Cargo.toml
+++ b/examples/sqlite/getting_started_step_3/Cargo.toml
@@ -8,6 +8,7 @@
 [dependencies]
 diesel = { version = "2.1.0", path = "../../../diesel", features = ["sqlite", "returning_clauses_for_sqlite_3_35"] }
 dotenvy = "0.15"
+libsqlite3-sys = { version = "0.27.0", features = ["bundled"] }
 
 [[bin]]
 name = "show_posts"