Skip to content

Commit 6096921

Browse files
authored
Update rust toolchain to 1.88 (#9061)
1 parent 923b5d9 commit 6096921

File tree

16 files changed

+56
-70
lines changed

16 files changed

+56
-70
lines changed

edb/edgeql-parser/edgeql-parser-python/src/normalize.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ pub fn normalize(text: &str) -> Result<Entry, Error> {
9191
let n = counter;
9292
counter += 1;
9393
if named_args {
94-
format!("$__edb_arg_{}", n)
94+
format!("$__edb_arg_{n}")
9595
} else {
96-
format!("${}", n)
96+
format!("${n}")
9797
}
9898
};
9999
let mut last_was_set = false;

edb/edgeql-parser/edgeql-parser-python/src/pynormalize.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ pub fn normalize(py: Python<'_>, text: &Bound<PyString>) -> PyResult<Entry> {
2525
py.None(),
2626
py.None(),
2727
))),
28-
Err(Error::Assertion(msg, pos)) => {
29-
Err(PyAssertionError::new_err(format!("{}: {}", pos, msg)))
30-
}
28+
Err(Error::Assertion(msg, pos)) => Err(PyAssertionError::new_err(format!("{pos}: {msg}"))),
3129
}
3230
}
3331

@@ -112,38 +110,38 @@ pub fn serialize_extra(variables: &[Variable]) -> Result<Bytes, String> {
112110
Value::Int(v) => {
113111
codec::Int64
114112
.encode(&mut buf, &P::Int64(v))
115-
.map_err(|e| format!("int cannot be encoded: {}", e))?;
113+
.map_err(|e| format!("int cannot be encoded: {e}"))?;
116114
}
117115
Value::String(ref v) => {
118116
codec::Str
119117
.encode(&mut buf, &P::Str(v.clone()))
120-
.map_err(|e| format!("str cannot be encoded: {}", e))?;
118+
.map_err(|e| format!("str cannot be encoded: {e}"))?;
121119
}
122120
Value::Float(ref v) => {
123121
codec::Float64
124122
.encode(&mut buf, &P::Float64(*v))
125-
.map_err(|e| format!("float cannot be encoded: {}", e))?;
123+
.map_err(|e| format!("float cannot be encoded: {e}"))?;
126124
}
127125
Value::BigInt(ref v) => {
128126
// We have two different versions of BigInt implementations here.
129127
// We have to use bigdecimal::num_bigint::BigInt because it can parse with radix 16.
130128

131129
let val = bigdecimal::num_bigint::BigInt::from_str_radix(v, 16)
132-
.map_err(|e| format!("bigint cannot be encoded: {}", e))
130+
.map_err(|e| format!("bigint cannot be encoded: {e}"))
133131
.and_then(|x| {
134-
BigInt::try_from(x).map_err(|e| format!("bigint cannot be encoded: {}", e))
132+
BigInt::try_from(x).map_err(|e| format!("bigint cannot be encoded: {e}"))
135133
})?;
136134

137135
codec::BigInt
138136
.encode(&mut buf, &P::BigInt(val))
139-
.map_err(|e| format!("bigint cannot be encoded: {}", e))?;
137+
.map_err(|e| format!("bigint cannot be encoded: {e}"))?;
140138
}
141139
Value::Decimal(ref v) => {
142140
let val = Decimal::try_from(v.clone())
143-
.map_err(|e| format!("decimal cannot be encoded: {}", e))?;
141+
.map_err(|e| format!("decimal cannot be encoded: {e}"))?;
144142
codec::Decimal
145143
.encode(&mut buf, &P::Decimal(val))
146-
.map_err(|e| format!("decimal cannot be encoded: {}", e))?;
144+
.map_err(|e| format!("decimal cannot be encoded: {e}"))?;
147145
}
148146
Value::Bytes(_) => {
149147
// bytes literals should not be extracted during normalization

edb/edgeql-parser/src/helpers/bytes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pub fn unquote_bytes(value: &str) -> Result<Vec<u8>, String> {
44
.ok_or_else(|| "invalid bytes literal: missing quotes".to_string())?;
55
let prefix = &value[..idx];
66
match prefix {
7-
"br" | "rb" => Ok(value[3..value.len() - 1].as_bytes().to_vec()),
7+
"br" | "rb" => Ok(value.as_bytes()[3..value.len() - 1].to_vec()),
88
"b" => Ok(unquote_bytes_inner(&value[2..value.len() - 1])?),
99
_ => Err(
1010
format_args!("prefix {prefix:?} is not allowed for bytes, allowed: `b`, `rb`",)

edb/edgeql-parser/src/helpers/strings.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,8 @@ fn _unquote_string(s: &str) -> Result<String, String> {
111111
if code > 0x7f || code == 0 {
112112
return Err(format!(
113113
"invalid string literal: \
114-
invalid escape sequence '\\x{:x}' \
115-
(only non-null ascii allowed)",
116-
code
114+
invalid escape sequence '\\x{code:x}' \
115+
(only non-null ascii allowed)"
117116
));
118117
}
119118
res.push(code as char);

edb/edgeql-parser/src/parser/cst.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl std::fmt::Display for Terminal {
4040
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4141
if (self.is_placeholder && self.kind == Kind::Ident) || self.text.is_empty() {
4242
if let Some(user_friendly) = self.kind.user_friendly_text() {
43-
return write!(f, "{}", user_friendly);
43+
return write!(f, "{user_friendly}");
4444
}
4545
}
4646

edb/edgeql-parser/src/tokenizer.rs

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -459,10 +459,9 @@ impl<'a> Tokenizer<'a> {
459459
"br" => (true, true),
460460
_ => {
461461
return Err(Error::new(format_args!(
462-
"prefix {:?} \
462+
"prefix {prefix:?} \
463463
is not allowed for strings, \
464-
allowed: `b`, `r`",
465-
prefix
464+
allowed: `b`, `r`"
466465
)))
467466
}
468467
};
@@ -471,10 +470,9 @@ impl<'a> Tokenizer<'a> {
471470
Some((idx, '`')) => {
472471
let prefix = &tail[..idx];
473472
return Err(Error::new(format_args!(
474-
"prefix {:?} is not \
473+
"prefix {prefix:?} is not \
475474
allowed for field names, perhaps missing \
476-
comma or dot?",
477-
prefix
475+
comma or dot?"
478476
)));
479477
}
480478
Some((_, c)) if c == '_' || c.is_alphanumeric() => continue,
@@ -501,10 +499,9 @@ impl<'a> Tokenizer<'a> {
501499
Some((_, '0'..='9')) => continue,
502500
Some((_, c)) if c.is_alphabetic() => {
503501
return Err(Error::new(format_args!(
504-
"unexpected char {:?}, \
502+
"unexpected char {c:?}, \
505503
only integers are allowed after dot \
506-
(for tuple access)",
507-
c
504+
(for tuple access)"
508505
)));
509506
}
510507
Some((idx, _)) => break idx,
@@ -593,7 +590,7 @@ impl<'a> Tokenizer<'a> {
593590
return Err(Error::new("dollar quote supports only ascii chars"));
594591
}
595592
if let Some(end) =
596-
find(self.buf[self.off + msize..].as_bytes(), marker.as_bytes())
593+
find(&self.buf.as_bytes()[self.off + msize..], marker.as_bytes())
597594
{
598595
let data = &self.buf[self.off + msize..][..end];
599596
for c in data.chars() {
@@ -602,8 +599,7 @@ impl<'a> Tokenizer<'a> {
602599
return Ok((Str, msize + end + msize));
603600
} else {
604601
return Err(Error::new(format_args!(
605-
"unterminated string started with {:?}",
606-
marker
602+
"unterminated string started with {marker:?}"
607603
)));
608604
}
609605
}
@@ -678,9 +674,8 @@ impl<'a> Tokenizer<'a> {
678674
c if c as u32 > 0x7f => {
679675
return Err(Error::new(format_args!(
680676
"invalid bytes literal: character \
681-
{:?} is unexpected, only ascii chars are \
682-
allowed in bytes literals",
683-
c
677+
{c:?} is unexpected, only ascii chars are \
678+
allowed in bytes literals"
684679
)));
685680
}
686681
c if c == open_quote => return Ok((Kind::BinStr, quote_off + idx + 1)),
@@ -702,8 +697,7 @@ impl<'a> Tokenizer<'a> {
702697
}
703698
}
704699
Err(Error::new(format_args!(
705-
"unterminated string, quoted by `{}`",
706-
open_quote
700+
"unterminated string, quoted by `{open_quote}`"
707701
)))
708702
}
709703

@@ -726,8 +720,7 @@ impl<'a> Tokenizer<'a> {
726720
}
727721
}
728722
Err(Error::new(format_args!(
729-
"unterminated string with interpolations, quoted by `{}`",
730-
end,
723+
"unterminated string with interpolations, quoted by `{end}`",
731724
)))
732725
}
733726

@@ -889,22 +882,19 @@ impl<'a> Tokenizer<'a> {
889882
};
890883
if suffix.starts_with('O') {
891884
Err(Error::new(format_args!(
892-
"suffix {:?} is invalid for \
885+
"suffix {suffix:?} is invalid for \
893886
numbers, perhaps mixed up letter `O` \
894-
with zero `0`?",
895-
suffix
887+
with zero `0`?"
896888
)))
897889
} else if decimal {
898890
return Err(Error::new(format_args!(
899-
"suffix {:?} is invalid for \
900-
numbers, perhaps you wanted `{}n` (decimal)?",
901-
suffix, val
891+
"suffix {suffix:?} is invalid for \
892+
numbers, perhaps you wanted `{val}n` (decimal)?"
902893
)));
903894
} else {
904895
return Err(Error::new(format_args!(
905-
"suffix {:?} is invalid for \
906-
numbers, perhaps you wanted `{}n` (bigint)?",
907-
suffix, val
896+
"suffix {suffix:?} is invalid for \
897+
numbers, perhaps you wanted `{val}n` (bigint)?"
908898
)));
909899
}
910900
}

edb/edgeql-parser/src/validation.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,13 @@ pub fn parse_value(token: &Token) -> Result<Option<Value>, String> {
155155
.parse()
156156
.map(Value::Decimal)
157157
.map(Some)
158-
.map_err(|e| format!("can't parse decimal: {}", e))
158+
.map_err(|e| format!("can't parse decimal: {e}"))
159159
}
160160
FloatConst => {
161161
return text
162162
.replace('_', "")
163163
.parse::<f64>()
164-
.map_err(|e| format!("can't parse std::float64: {}", e))
164+
.map_err(|e| format!("can't parse std::float64: {e}"))
165165
.and_then(|num| {
166166
if num.is_infinite() {
167167
return Err("number is out of range for std::float64".to_string());
@@ -187,13 +187,13 @@ pub fn parse_value(token: &Token) -> Result<Option<Value>, String> {
187187
// value, though.
188188
return u64::from_str(&text.replace('_', ""))
189189
.map(|x| Some(Value::Int(x as i64)))
190-
.map_err(|e| format!("error reading int: {}", e));
190+
.map_err(|e| format!("error reading int: {e}"));
191191
}
192192
BigIntConst => {
193193
return text[..text.len() - 1]
194194
.replace('_', "")
195195
.parse::<BigDecimal>()
196-
.map_err(|e| format!("error reading bigint: {}", e))
196+
.map_err(|e| format!("error reading bigint: {e}"))
197197
// this conversion to decimal and back to string
198198
// fixes thing like `1e2n` which we support for bigints
199199
.and_then(|x| {

edb/edgeql-parser/tests/preparser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fn test_statement(data: &[u8], len: usize) {
44
for i in 0..len - 1 {
55
let c = full_statement(&data[..i], None).unwrap_err();
66
let parsed_len = full_statement(data, Some(c)).unwrap();
7-
assert_eq!(len, parsed_len, "at {}", i);
7+
assert_eq!(len, parsed_len, "at {i}");
88
}
99
for i in len..data.len() {
1010
let parsed_len = full_statement(&data[..i], None).unwrap();

edb/graphql-rewrite/src/py_entry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub fn convert_entry(py: Python<'_>, entry: rewrite::Entry) -> PyResult<Entry> {
6161
let vars = PyDict::new(py);
6262
let substitutions = PyDict::new(py);
6363
for (idx, var) in entry.variables.iter().enumerate() {
64-
let s = format!("__edb_arg_{}", idx).into_pyobject(py)?;
64+
let s = format!("__edb_arg_{idx}").into_pyobject(py)?;
6565

6666
vars.set_item(&s, value_to_py(py, &var.value, &decimal_cls)?)?;
6767
substitutions.set_item(

edb/graphql-rewrite/src/rewrite.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub fn rewrite(operation: Option<&str>, s: &str) -> Result<Entry, Error> {
5959
let document: Document<'_, &str> = parse_query(s).map_err(Error::Syntax)?;
6060
let oper = if let Some(oper_name) = operation {
6161
find_operation(&document, oper_name)
62-
.ok_or_else(|| Error::NotFound(format!("no operation {:?} found", operation)))?
62+
.ok_or_else(|| Error::NotFound(format!("no operation {operation:?} found")))?
6363
} else {
6464
let mut oper = None;
6565
for def in &document.definitions {

0 commit comments

Comments
 (0)