Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

Commit af93298

Browse files
authored
remove useless patches (#742)
1 parent 1beda6e commit af93298

File tree

16 files changed

+284
-257
lines changed

16 files changed

+284
-257
lines changed

Cargo.lock

Lines changed: 214 additions & 215 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[workspace]
22

3+
resolver = "2"
34
members = [
45
"bottomless",
56
"bottomless-cli",
@@ -33,12 +34,8 @@ publish-jobs = ["homebrew"]
3334
# Whether cargo-dist should create a Github Release or use an existing draft
3435
create-release = false
3536

36-
# TODO(lucio): Remove this once tonic has released a new version with fixes
3737
[patch.crates-io]
38-
tonic = { git = "https://github.com/hyperium/tonic" }
39-
tonic-build = { git = "https://github.com/hyperium/tonic" }
40-
console-api = { git = "https://github.com/tokio-rs/console", branch = "lucio/tonic-fix" }
41-
libsql = { git = "https://github.com/libsql/libsql.git", rev = "61b4f5b" }
38+
sqlite3-parser = { git = "https://github.com/LucioFranco/lemon-rs" }
4239

4340
# The profile that 'cargo dist' will build with
4441
[profile.dist]

bottomless/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,9 @@ pub mod static_init {
583583
INIT.call_once(|| {
584584
crate::bottomless_init();
585585
let orig_methods = unsafe { libsql_wal_methods_find(std::ptr::null()) };
586-
if orig_methods.is_null() {}
586+
if orig_methods.is_null() {
587+
panic!("failed to locate default WAL methods")
588+
}
587589
let methods = crate::bottomless_methods(orig_methods);
588590
let rc = unsafe { libsql_wal_methods_register(methods) };
589591
if rc != crate::ffi::SQLITE_OK {

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
22
profile = "default"
3-
channel = "1.70.0"
3+
channel = "1.73.0"

sqld/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ hyper-rustls = { git = "https://github.com/rustls/hyper-rustls.git", rev = "163b
7070
rustls-pemfile = "1.0.3"
7171
rustls = "0.21.7"
7272
async-stream = "0.3.5"
73-
libsql = { version = "0.1", optional = true }
73+
libsql = { git = "https://github.com/tursodatabase/libsql.git", rev = "bea8863", optional = true }
7474

7575
[dev-dependencies]
7676
proptest = "1.0.0"

sqld/src/auth.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ impl Auth {
7979
}
8080

8181
let Some(auth_header) = auth_header else {
82-
return Err(AuthError::HttpAuthHeaderMissing)
82+
return Err(AuthError::HttpAuthHeaderMissing);
8383
};
8484

8585
match parse_http_auth_header(auth_header)? {
8686
HttpAuthHeader::Basic(actual_value) => {
8787
let Some(expected_value) = self.http_basic.as_ref() else {
88-
return Err(AuthError::BasicNotAllowed)
88+
return Err(AuthError::BasicNotAllowed);
8989
};
9090
// NOTE: this naive comparison may leak information about the `expected_value`
9191
// using a timing attack
@@ -133,7 +133,7 @@ impl Auth {
133133
}
134134

135135
let Some(jwt) = jwt else {
136-
return Err(AuthError::JwtMissing)
136+
return Err(AuthError::JwtMissing);
137137
};
138138

139139
self.validate_jwt(jwt, disable_namespaces)
@@ -145,7 +145,7 @@ impl Auth {
145145
disable_namespaces: bool,
146146
) -> Result<Authenticated, AuthError> {
147147
let Some(jwt_key) = self.jwt_key.as_ref() else {
148-
return Err(AuthError::JwtNotAllowed)
148+
return Err(AuthError::JwtNotAllowed);
149149
};
150150
validate_jwt(jwt_key, jwt, disable_namespaces)
151151
}
@@ -250,11 +250,11 @@ fn parse_http_auth_header(
250250
header: &hyper::header::HeaderValue,
251251
) -> Result<HttpAuthHeader, AuthError> {
252252
let Ok(header) = header.to_str() else {
253-
return Err(AuthError::HttpAuthHeaderInvalid)
253+
return Err(AuthError::HttpAuthHeaderInvalid);
254254
};
255255

256256
let Some((scheme, param)) = header.split_once(' ') else {
257-
return Err(AuthError::HttpAuthHeaderInvalid)
257+
return Err(AuthError::HttpAuthHeaderInvalid);
258258
};
259259

260260
if scheme.eq_ignore_ascii_case("basic") {

sqld/src/connection/dump/exporter.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,15 @@ impl<W: Write> DumpState<W> {
2424
let mut stmt = txn.prepare(stmt)?;
2525
let mut rows = stmt.query(())?;
2626
while let Some(row) = rows.next()? {
27-
let ValueRef::Text(table) = row.get_ref(0)? else { bail!("invalid schema table") };
28-
let ValueRef::Text(ty) = row.get_ref(1)? else { bail!("invalid schema table") };
29-
let ValueRef::Text(sql) = row.get_ref(2)? else { bail!("invalid schema table") };
27+
let ValueRef::Text(table) = row.get_ref(0)? else {
28+
bail!("invalid schema table")
29+
};
30+
let ValueRef::Text(ty) = row.get_ref(1)? else {
31+
bail!("invalid schema table")
32+
};
33+
let ValueRef::Text(sql) = row.get_ref(2)? else {
34+
bail!("invalid schema table")
35+
};
3036

3137
if table == b"sqlite_sequence" {
3238
writeln!(self.writer, "DELETE FROM sqlite_sequence;")?;
@@ -120,10 +126,14 @@ impl<W: Write> DumpState<W> {
120126
let col_count = stmt.column_count();
121127
let mut rows = stmt.query(())?;
122128
while let Some(row) = rows.next()? {
123-
let ValueRef::Text(sql) = row.get_ref(0)? else { bail!("the first row in a table dump query should be of type text") };
129+
let ValueRef::Text(sql) = row.get_ref(0)? else {
130+
bail!("the first row in a table dump query should be of type text")
131+
};
124132
self.writer.write_all(sql)?;
125133
for i in 1..col_count {
126-
let ValueRef::Text(s) = row.get_ref(i)? else { bail!("row {i} in table dump query should be of type text") };
134+
let ValueRef::Text(s) = row.get_ref(i)? else {
135+
bail!("row {i} in table dump query should be of type text")
136+
};
127137
let s = std::str::from_utf8(s)?;
128138
write!(self.writer, ",{s}")?;
129139
}
@@ -258,7 +268,7 @@ impl Display for Quoted<'_> {
258268
let s = &self.0;
259269
let Some(first) = s.chars().next() else {
260270
write!(f, "{s}")?;
261-
return Ok(())
271+
return Ok(());
262272
};
263273
if !first.is_alphabetic() && first != '_' {
264274
write!(f, r#""{s}""#)?;

sqld/src/hrana/cursor.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ async fn run_cursor<C: Connection>(
7878
open_rx: oneshot::Receiver<OpenReq<C>>,
7979
entry_tx: mpsc::Sender<Result<SizedEntry>>,
8080
) {
81-
let Ok(open_req) = open_rx.await else {
82-
return
83-
};
81+
let Ok(open_req) = open_rx.await else { return };
8482

8583
let result_builder = CursorResultBuilder {
8684
entry_tx: entry_tx.clone(),

sqld/src/hrana/http/stream.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ pub async fn acquire<'srv, D: Connection>(
142142
}
143143
};
144144

145-
let Handle::Available(mut stream) = mem::replace(handle.unwrap(), Handle::Acquired) else {
145+
let Handle::Available(mut stream) = mem::replace(handle.unwrap(), Handle::Acquired)
146+
else {
146147
unreachable!()
147148
};
148149

@@ -235,8 +236,10 @@ impl<'srv, D> Drop for Guard<'srv, D> {
235236

236237
let mut state = self.server.stream_state.lock();
237238
let Some(handle) = state.handles.remove(&stream_id) else {
238-
panic!("Dropped a Guard for stream {stream_id}, \
239-
but Server does not contain a handle to it");
239+
panic!(
240+
"Dropped a Guard for stream {stream_id}, \
241+
but Server does not contain a handle to it"
242+
);
240243
};
241244
if !matches!(handle, Handle::Acquired) {
242245
panic!(

sqld/src/hrana/ws/handshake.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@ fn negotiate_subproto(
153153
.map(|s| s.as_str())
154154
.collect::<Vec<_>>()
155155
.join(" ");
156-
return Err(format!("Only these WebSocket subprotocols are supported: {}", supported))
156+
return Err(format!(
157+
"Only these WebSocket subprotocols are supported: {}",
158+
supported
159+
));
157160
};
158161

159162
tracing::debug!(

0 commit comments

Comments
 (0)