Skip to content

Commit 451cef3

Browse files
goffrieConvex, Inc.
authored and
Convex, Inc.
committed
Upgrade Rust to 2024-12-16 (#32566)
GitOrigin-RevId: 003a15e6970b7caba6ac6fdf5ad4121fddc8ba74
1 parent 0a1d183 commit 451cef3

File tree

95 files changed

+132
-202
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+132
-202
lines changed

crates/application/src/application_function_runner/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ struct RequestGuard<'a> {
526526
permit: Option<SemaphorePermit<'a>>,
527527
}
528528

529-
impl<'a> RequestGuard<'a> {
529+
impl RequestGuard<'_> {
530530
async fn acquire_permit(&mut self) -> anyhow::Result<()> {
531531
let timer = function_waiter_timer(self.limiter.udf_type);
532532
assert!(
@@ -541,7 +541,7 @@ impl<'a> RequestGuard<'a> {
541541
}
542542
}
543543

544-
impl<'a> Drop for RequestGuard<'a> {
544+
impl Drop for RequestGuard<'_> {
545545
fn drop(&mut self) {
546546
// Drop the semaphore permit before updating gauges.
547547
drop(self.permit.take());

crates/application/src/cache/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ impl<'a> WaitingEntryGuard<'a> {
584584
}
585585
}
586586

587-
impl<'a> Drop for WaitingEntryGuard<'a> {
587+
impl Drop for WaitingEntryGuard<'_> {
588588
fn drop(&mut self) {
589589
// Remove the cache entry from the cache if still present.
590590
if let Some(entry_id) = self.entry_id {

crates/application/src/deploy_config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ impl<'a, RT: Runtime> ApplicationInitializerEvaluator<'a, RT> {
615615
}
616616

617617
#[async_trait]
618-
impl<'a, RT: Runtime> InitializerEvaluator for ApplicationInitializerEvaluator<'a, RT> {
618+
impl<RT: Runtime> InitializerEvaluator for ApplicationInitializerEvaluator<'_, RT> {
619619
async fn evaluate(
620620
&self,
621621
path: ComponentDefinitionPath,

crates/application/src/function_log.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1521,7 +1521,7 @@ impl<RT: Runtime> Inner<RT> {
15211521
static LAST_LOGGED_ERROR: Cell<Option<SystemTime>> = const { Cell::new(None) };
15221522
}
15231523
let now = SystemTime::now();
1524-
let should_log = LAST_LOGGED_ERROR.get().map_or(true, |last_logged| {
1524+
let should_log = LAST_LOGGED_ERROR.get().is_none_or(|last_logged| {
15251525
now.duration_since(last_logged).unwrap_or(Duration::ZERO) >= Duration::from_secs(10)
15261526
});
15271527
if !should_log {

crates/application/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(try_blocks)]
2-
#![feature(lazy_cell)]
32
#![feature(iterator_try_collect)]
43
#![feature(let_chains)]
54
#![feature(coroutines)]

crates/application/src/snapshot_import/parse.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ async fn parse_documents_jsonl<'a, R: TokioAsyncRead + Unpin>(
456456
}
457457
}
458458

459-
async fn parse_generated_schema<'a, T: ShapeConfig, R: AsyncRead + Unpin>(
459+
async fn parse_generated_schema<T: ShapeConfig, R: AsyncRead + Unpin>(
460460
filename: &str,
461461
mut entry_reader: BufReader<R>,
462462
) -> anyhow::Result<GeneratedSchema<T>> {

crates/application/src/snapshot_import/schema_constraints.rs

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use value::{
2525
/// 2. import does not touch table "bar".
2626
/// 3. "bar" has a foreign reference to "foo", validated by schema.
2727
/// 4. when the import commits, "bar" is nonempty.
28+
///
2829
/// To prevent this case we throw an error if a schema'd table outside the
2930
/// import is nonempty and points into the import, and the import changes the
3031
/// table number.

crates/async_lru/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
#![feature(let_chains)]
2-
#![feature(lazy_cell)]
32
pub mod async_lru;
43
mod metrics;

crates/authentication/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(lazy_cell)]
21
use std::{
32
str::FromStr,
43
sync::LazyLock,
@@ -62,8 +61,6 @@ const CONFIG_URL_SUFFIX: &str = ".well-known/jwks.json";
6261
/// and not user-facing. These API access tokens are constructed from multiple
6362
/// clients (eg dashboard/cli)
6463
pub const CONVEX_CONSOLE_API_AUDIENCE: &str = "https://console.convex.dev/api/";
65-
/// Scopes required for an access token to be considered valid.
66-
/// Not really used meaningfully yet, but might be in the future.
6764

6865
/// Extract the bearer token from an `Authorization: Bearer` header.
6966
pub async fn extract_bearer_token(header: Option<String>) -> anyhow::Result<Option<String>> {

crates/cmd_util/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
#![feature(lazy_cell)]
21
pub mod env;
32
pub mod keyvalue;

crates/common/src/auth.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ where
5151
.and_then(|url: IssuerUrl| {
5252
// Check if the input really looks like a URL,
5353
// to catch mistakes (e.g. putting random tokens in the domain field)
54-
if !had_scheme && !url.url().host_str().map_or(false, ends_with_tld) {
54+
if !had_scheme && !url.url().host_str().is_some_and(ends_with_tld) {
5555
return Err(serde::de::Error::custom(
5656
"Does not look like a URL (must have a scheme or end with a top-level domain)",
5757
));

crates/common/src/bootstrap_model/schema.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub fn parse_schema_id(
2525
Err(_) => {
2626
// Try parsing as an IDv6 ID
2727
let id = DeveloperDocumentId::decode(schema_id)?;
28-
id.to_resolved(&table_mapping.namespace(namespace).number_to_tablet())
28+
id.to_resolved(table_mapping.namespace(namespace).number_to_tablet())
2929
},
3030
}
3131
}

crates/common/src/bootstrap_model/schema_state.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ use value::codegen_convex_serialization;
2222
/// ```
2323
/// Invariants:
2424
/// 1. At most one schema can be in the `Pending` or `Validated` state at a
25-
/// time.
26-
///
25+
/// time.
2726
/// 2. At most one schema can be in the `Active` state at a time.
2827
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2928
#[cfg_attr(any(test, feature = "testing"), derive(proptest_derive::Arbitrary))]

crates/common/src/comparators/lower_bound.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,21 @@ impl<'a, Q: ?Sized, T: Borrow<Q> + 'a> Borrow<dyn LowerBoundKey<Q> + 'a> for Low
2929
}
3030
}
3131

32-
impl<'a, T: Ord + ?Sized> Ord for dyn LowerBoundKey<T> + 'a {
32+
impl<T: Ord + ?Sized> Ord for dyn LowerBoundKey<T> + '_ {
3333
fn cmp(&self, other: &Self) -> Ordering {
3434
self.key().cmp(&other.key())
3535
}
3636
}
3737

38-
impl<'a, T: Ord + ?Sized> PartialOrd for dyn LowerBoundKey<T> + 'a {
38+
impl<T: Ord + ?Sized> PartialOrd for dyn LowerBoundKey<T> + '_ {
3939
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
4040
Some(self.cmp(other))
4141
}
4242
}
4343

44-
impl<'a, T: Eq + ?Sized> Eq for dyn LowerBoundKey<T> + 'a {}
44+
impl<T: Eq + ?Sized> Eq for dyn LowerBoundKey<T> + '_ {}
4545

46-
impl<'a, T: PartialEq + ?Sized> PartialEq for dyn LowerBoundKey<T> + 'a {
46+
impl<T: PartialEq + ?Sized> PartialEq for dyn LowerBoundKey<T> + '_ {
4747
fn eq(&self, other: &Self) -> bool {
4848
self.key().eq(&other.key())
4949
}

crates/common/src/http/extract.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ fn json_content_type(headers: &HeaderMap) -> bool {
139139
return false;
140140
};
141141
mime.type_() == "application"
142-
&& (mime.subtype() == "json" || mime.suffix().map_or(false, |name| name == "json"))
142+
&& (mime.subtype() == "json" || mime.suffix().is_some_and(|name| name == "json"))
143143
}
144144

145145
impl<T> IntoResponse for Json<T>

crates/common/src/id_tracker.rs

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ pub const ID_TABLE_VERSION: u8 = 1;
3939
/// This implementation currently loads the full indexes into memory, but we
4040
/// could eventually change this to use `mmap(2)` to lazily load pieces as
4141
/// necessary.
42-
4342
pub struct StaticIdTracker {
4443
count: usize,
4544
/// Convex IDs in search/vector index id order.

crates/common/src/knobs.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -548,10 +548,10 @@ pub static WRITE_LOG_MAX_RETENTION_SECS: LazyLock<Duration> =
548548

549549
/// The maximum size of the write log. Notes:
550550
/// - the write log will be trimmed based on WRITE_LOG_MAX_RETENTION_SECS, and
551-
/// thus it might never reach this size.
551+
/// thus it might never reach this size.
552552
/// - the write log always retains at least WRITE_LOG_MIN_RETENTION_SECS, and
553-
/// thus we could exceed this limit. The reason we do that is to allow some
554-
/// minimum buffer for queries to refresh after execution.
553+
/// thus we could exceed this limit. The reason we do that is to allow some
554+
/// minimum buffer for queries to refresh after execution.
555555
pub static WRITE_LOG_SOFT_MAX_SIZE_BYTES: LazyLock<usize> =
556556
LazyLock::new(|| env_config("WRITE_LOG_SOFT_MAX_SIZE_BYTES", 50 * 1024 * 1024));
557557

crates/common/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,16 @@
22
#![feature(assert_matches)]
33
#![feature(binary_heap_drain_sorted)]
44
#![feature(const_for)]
5-
#![feature(const_mut_refs)]
6-
#![feature(const_option)]
75
#![feature(const_type_name)]
86
#![feature(coroutines)]
97
#![feature(iter_intersperse)]
108
#![feature(let_chains)]
119
#![feature(nonzero_ops)]
12-
#![feature(lazy_cell)]
1310
#![feature(try_blocks)]
1411
#![feature(type_alias_impl_trait)]
1512
#![feature(bound_as_ref)]
1613
#![feature(iter_from_coroutine)]
1714
#![feature(iterator_try_collect)]
18-
#![feature(async_closure)]
1915
#![feature(error_iter)]
2016
#![feature(impl_trait_in_assoc_type)]
2117
#![feature(round_char_boundary)]

crates/common/src/minitrace_helpers.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ fn validate_fraction(value: f64, context: &str) -> anyhow::Result<f64> {
176176
Ok(value)
177177
}
178178

179+
static DOT_STAR: LazyLock<Regex> =
180+
LazyLock::new(|| Regex::new(".*").expect(".* is not a valid regex"));
181+
179182
impl TryFrom<SamplingConfigJson> for SamplingConfig {
180183
type Error = anyhow::Error;
181184

@@ -203,7 +206,7 @@ impl TryFrom<SamplingConfigJson> for SamplingConfig {
203206
}
204207
by_regex.push((
205208
None,
206-
Regex::new(".*").expect(".* is not a valid regex"),
209+
DOT_STAR.clone(),
207210
validate_fraction(json.default_fraction, "default")?,
208211
));
209212
Ok(SamplingConfig { by_regex })
@@ -238,9 +241,8 @@ impl FromStr for SamplingConfig {
238241
let rate: f64 = parts[1].parse().context("Failed to parse sampling rate")?;
239242
(regex, rate)
240243
} else {
241-
let regex = Regex::new(".*").expect(".* is not a valid regex");
242244
let rate: f64 = parts[0].parse().context("Failed to parse sampling rate")?;
243-
(regex, rate)
245+
(DOT_STAR.clone(), rate)
244246
};
245247
by_regex.push((instance_name, name_regex, rate));
246248
}

crates/common/src/pause.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ mod test_pause {
7474
fault: Fault,
7575
}
7676

77-
impl<'a> PauseGuard<'a> {
77+
impl PauseGuard<'_> {
7878
pub fn inject_error(&mut self, error: anyhow::Error) {
7979
self.fault = Fault::Error(error);
8080
}
@@ -101,7 +101,7 @@ mod test_pause {
101101
}
102102
}
103103

104-
impl<'a> Drop for PauseGuard<'a> {
104+
impl Drop for PauseGuard<'_> {
105105
fn drop(&mut self) {
106106
if !self.unpaused {
107107
tracing::info!("Unpausing waiter for {:?} on unclean drop", self.label);

crates/common/src/schemas/validator.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -563,14 +563,14 @@ impl Validator {
563563
}
564564

565565
fn is_valid_vector_validator(validator: &Validator) -> bool {
566-
return match validator {
566+
match validator {
567567
Validator::Array(validator) => {
568568
matches!(**validator, Validator::Float64 | Validator::Any)
569569
},
570570
Validator::Any => true,
571571
Validator::Union(validators) => validators.iter().any(Self::is_valid_vector_validator),
572572
_ => false,
573-
};
573+
}
574574
}
575575

576576
fn _overlaps_with_array_float64(&self, field_path_parts: &[IdentifierFieldName]) -> bool {

crates/common/src/types/environment_variables.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ impl AsRef<str> for EnvVarValue {
5757
static NAME_REGEX: LazyLock<Regex> =
5858
LazyLock::new(|| Regex::new(r"^[a-zA-Z_]+[a-zA-Z0-9_]*$").unwrap());
5959

60-
/// NOTE: Make sure to update the doc if you change any of these limits. Also
61-
/// don't reduce them since that might break existing projects.
60+
// NOTE: Make sure to update the doc if you change any of these limits. Also
61+
// don't reduce them since that might break existing projects.
6262

6363
/// Maximum number of environment variables that can be stored.
6464
/// Also update client-side limit GenericEnvironmentVariables.tsx.

crates/common/src/utils.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ pub fn increment_name(name: &str, amt: u64) -> String {
4040
.and_then(|c| c.get(2))
4141
.and_then(|m| m.as_str().parse::<u64>().ok())
4242
{
43-
return NAME_NUMBER_RE
43+
NAME_NUMBER_RE
4444
.replace(name, |caps: &regex::Captures| {
4545
format!("{} ({})", &caps[1], number + amt)
4646
})
47-
.into();
47+
.into()
4848
} else {
4949
format!("{name} ({amt})")
5050
}

crates/common/src/version.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,7 @@ impl FromStr for ClientVersion {
332332
(client_str, version)
333333
},
334334
};
335-
let Ok(client) = client_str.parse::<ClientType>() else {
336-
unreachable!()
337-
};
335+
let Ok(client) = client_str.parse::<ClientType>();
338336
Ok(Self { client, version })
339337
}
340338
}

crates/config_loader/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//! a signal
33
44
#![feature(try_blocks)]
5-
#![feature(lazy_cell)]
65
#![feature(trait_alias)]
76

87
use std::path::PathBuf;

crates/convex/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
//!
3939
//! Detailed examples of both use cases are documented for each struct.
4040
41-
#![warn(missing_docs)]
41+
#![cfg_attr(not(test), warn(missing_docs))]
4242
#![warn(rustdoc::missing_crate_level_docs)]
4343

4444
mod value;

crates/convex/sync_types/src/identifier.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ pub const IDENTIFIER_REQUIREMENTS: &str =
1212
/// Check that a string can be used for a table name or field name in a
1313
/// document.
1414
///
15-
/// We use a simplified ASCII version of Rust's syntax [^1] which also overlaps
16-
/// with JavaScript's syntax [^2].
15+
/// We use a simplified ASCII version of Rust's syntax[^1] which also overlaps
16+
/// with JavaScript's syntax[^2].
1717
///
1818
/// ```text
1919
/// ident: start continue*
2020
/// start: a-zA-z_
2121
/// continue: a-zA-Z0-9_
2222
/// ```
23-
/// [^3][^4]
23+
/// [^3] [^4]
2424
/// To be conservative, let's also ban identifiers of entirely `_` too.
2525
///
26-
/// [1]: <https://doc.rust-lang.org/reference/identifiers.html>
27-
/// [2]: <https://developer.mozilla.org/en-US/docs/Glossary/Identifier>
28-
/// [3]: <https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%3AXID_START%3A%5D&g=&i=>
29-
/// [4]: <https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%3AXID_CONTINUE%3A%5D&g=&i=>
26+
/// [^1]: <https://doc.rust-lang.org/reference/identifiers.html>
27+
/// [^2]: <https://developer.mozilla.org/en-US/docs/Glossary/Identifier>
28+
/// [^3]: <https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%3AXID_START%3A%5D&g=&i=>
29+
/// [^4]: <https://util.unicode.org/UnicodeJsps/list-unicodeset.jsp?a=%5B%3AXID_CONTINUE%3A%5D&g=&i=>
3030
pub fn check_valid_identifier(s: &str) -> anyhow::Result<()> {
3131
check_valid_identifier_inner(s).map_err(|e| anyhow::anyhow!(e))
3232
}

crates/convex/sync_types/src/json.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ use crate::{
4343
/// by default, with loss of precision.
4444
///
4545
/// e.g. (this number is 2^60)
46-
/// > JSON.parse("{\"foo\": 1152921504606846976}")
47-
/// { foo: 1152921504606847000 }
46+
/// > JSON.parse("{\"foo\": 1152921504606846976}")
47+
/// { foo: 1152921504606847000 }
4848
///
4949
/// So instead we send it down as a string and unpack it ourselves.
5050
fn u64_to_string(x: u64) -> String {

crates/database/benches/subscriptions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ fn load_datasets(
108108
let mut terms = 0;
109109
for dataset in datasets {
110110
let mut frequency_map: BTreeMap<String, u32> = BTreeMap::new();
111-
let f = File::open(&format!("{path}/{dataset}.jsonl"))?;
111+
let f = File::open(format!("{path}/{dataset}.jsonl"))?;
112112
let f = BufReader::new(f);
113113
let mut documents = vec![];
114114
let mut m = 0;

crates/database/src/bootstrap_model/user_facing.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,7 @@ impl<'a, RT: Runtime> UserFacingModel<'a, RT> {
259259
self.tx.retention_validator.fail_if_falling_behind()?;
260260

261261
let id_ = id.to_resolved(
262-
&self
263-
.tx
262+
self.tx
264263
.table_mapping()
265264
.namespace(self.namespace)
266265
.number_to_tablet(),
@@ -296,8 +295,7 @@ impl<'a, RT: Runtime> UserFacingModel<'a, RT> {
296295
}
297296
self.tx.retention_validator.fail_if_falling_behind()?;
298297
let id_ = id.to_resolved(
299-
&self
300-
.tx
298+
self.tx
301299
.table_mapping()
302300
.namespace(self.namespace)
303301
.number_to_tablet(),
@@ -322,8 +320,7 @@ impl<'a, RT: Runtime> UserFacingModel<'a, RT> {
322320
self.tx.retention_validator.fail_if_falling_behind()?;
323321

324322
let id_ = id.to_resolved(
325-
&self
326-
.tx
323+
self.tx
327324
.table_mapping()
328325
.namespace(self.namespace)
329326
.number_to_tablet(),

0 commit comments

Comments
 (0)