Skip to content

Commit 64b88f0

Browse files
authored
Updated nightly version. (#7719)
1 parent 60214b7 commit 64b88f0

File tree

41 files changed

+95
-104
lines changed

Some content is hidden

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

41 files changed

+95
-104
lines changed

.github/workflows/ci.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v4
1515
- uses: dtolnay/rust-toolchain@master
1616
with:
17-
toolchain: nightly-2025-04-04
17+
toolchain: nightly-2025-04-28
1818
targets: wasm32-unknown-unknown
1919
- uses: Swatinem/rust-cache@v2
2020
- run: |
@@ -67,7 +67,7 @@ jobs:
6767
- uses: dtolnay/rust-toolchain@master
6868
with:
6969
components: rustfmt
70-
toolchain: nightly-2025-04-04
70+
toolchain: nightly-2025-04-28
7171
- uses: dtolnay/rust-toolchain@stable
7272
- uses: Swatinem/rust-cache@v2
7373
- name: Install nextest
@@ -101,7 +101,7 @@ jobs:
101101
- uses: dtolnay/rust-toolchain@master
102102
with:
103103
components: rustfmt
104-
toolchain: nightly-2025-04-04
104+
toolchain: nightly-2025-04-28
105105
- uses: Swatinem/rust-cache@v2
106106
- run: scripts/rust_fmt.sh --check
107107

@@ -140,7 +140,7 @@ jobs:
140140
- uses: dtolnay/rust-toolchain@master
141141
with:
142142
components: clippy
143-
toolchain: nightly-2025-04-04
143+
toolchain: nightly-2025-04-28
144144
- uses: Swatinem/rust-cache@v2
145145
- run: >
146146
scripts/clippy.sh
@@ -157,7 +157,7 @@ jobs:
157157
- uses: actions/checkout@v4
158158
- uses: dtolnay/rust-toolchain@master
159159
with:
160-
toolchain: nightly-2025-04-04
160+
toolchain: nightly-2025-04-28
161161
- uses: Swatinem/rust-cache@v2
162162
- run: >
163163
scripts/docs.sh

crates/bin/cairo-run/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ fn main() -> anyhow::Result<()> {
108108
match result.profiling_info {
109109
Some(raw_profiling_info) => {
110110
let profiling_info = profiling_info_processor.process(&raw_profiling_info);
111-
println!("Profiling info:\n{}", profiling_info);
111+
println!("Profiling info:\n{profiling_info}");
112112
}
113113
None => println!("Warning: Profiling info not found."),
114114
}

crates/bin/cairo-size-profiler/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ fn main() -> anyhow::Result<()> {
188188
}
189189

190190
let total_size: usize = casm.instructions.iter().map(|inst| inst.body.op_size()).sum();
191-
println!("Total weight (felt252 count): {}", total_size);
191+
println!("Total weight (felt252 count): {total_size}");
192192

193193
println!("Weight by concrete libfunc:");
194194
for (concrete_name, weight) in filter_and_sort(concrete_libfunc_size) {

crates/bin/starknet-sierra-upgrade-validate/src/main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ fn spawn_class_processors(
312312
tokio::spawn(async move {
313313
while let Ok(sierra_class) = classes_rx.recv().await {
314314
if let Err(err) = results_tx.send(run_single(sierra_class, config.as_ref())).await {
315-
eprintln!("Failed to send result: {:#?}", err);
315+
eprintln!("Failed to send result: {err:#?}");
316316
}
317317
// Additional yield to prevent starvation of the inputs handling stage.
318318
tokio::task::yield_now().await;
@@ -436,7 +436,7 @@ fn analyze_report(
436436
&& compilation_failures.is_empty()
437437
&& compilation_mismatch.is_empty()
438438
{
439-
println!("All {} classes passed validation and compilation.", num_of_classes);
439+
println!("All {num_of_classes} classes passed validation and compilation.");
440440
Ok(())
441441
} else {
442442
Err(anyhow::anyhow!("Failed."))

crates/cairo-lang-casm/src/cell_expression.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl core::fmt::Display for CellExpression {
135135
match self {
136136
CellExpression::Deref(cell) => write!(f, "{cell}"),
137137
CellExpression::DoubleDeref(cell, offset) => write!(f, "[{cell} + {offset}]"),
138-
CellExpression::Immediate(imm) => write!(f, "{}", imm),
138+
CellExpression::Immediate(imm) => write!(f, "{imm}"),
139139
CellExpression::BinOp { op, a, b } => write!(f, "{a} {op} {b}"),
140140
}
141141
}

crates/cairo-lang-casm/src/hints/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub enum Hint {
3636

3737
impl Hint {
3838
pub fn representing_string(&self) -> String {
39-
format!("{:?}", self)
39+
format!("{self:?}")
4040
}
4141
}
4242

crates/cairo-lang-defs/src/patcher.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl RewriteNode {
190190
// Replace the substring with the relevant rewrite node.
191191
// TODO(yuval): this currently panics. Fix it.
192192
children.push(
193-
patches.get(&name).cloned().unwrap_or_else(|| panic!("No patch named {}.", name)),
193+
patches.get(&name).cloned().unwrap_or_else(|| panic!("No patch named {name}.")),
194194
);
195195
}
196196
// Flush the remaining text as a text child.

crates/cairo-lang-diagnostics/src/error_code.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl ErrorCode {
2626
/// assert_eq!(error_code!(E0001).display_bracketed(), "[E0001]");
2727
/// ```
2828
pub fn display_bracketed(self) -> String {
29-
format!("[{}]", self)
29+
format!("[{self}]")
3030
}
3131

3232
pub fn as_str(&self) -> &str {

crates/cairo-lang-doc/src/db.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fn get_item_documentation(db: &dyn DocGroup, item_id: DocumentableItemId) -> Opt
4646
DocumentationCommentToken::Link(link) => {
4747
write!(&mut buff, "[{}]", link.label).ok()?;
4848
if let Some(path) = &link.path {
49-
write!(&mut buff, "({})", path).ok()?;
49+
write!(&mut buff, "({path})").ok()?;
5050
}
5151
}
5252
}

crates/cairo-lang-doc/src/documentable_formatter.rs

+11-15
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ impl fmt::Display for SignatureError {
4343
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4444
match self {
4545
SignatureError::FailedRetrievingSemanticData(full_path) => {
46-
write!(f, "Failed retrieving semantic data for {:?}.", full_path)
46+
write!(f, "Failed retrieving semantic data for {full_path:?}.")
4747
}
4848
SignatureError::FailedWritingSignature(full_path) => {
49-
write!(f, "Failed writing signature for {:?}.", full_path)
49+
write!(f, "Failed writing signature for {full_path:?}.")
5050
}
5151
SignatureError::FailedWritingType(full_path) => {
52-
write!(f, "Failed writing a type for {:?}.", full_path)
52+
write!(f, "Failed writing a type for {full_path:?}.")
5353
}
5454
}
5555
}
@@ -460,7 +460,7 @@ impl HirDisplay for ConstantId {
460460
)
461461
},
462462
)?;
463-
write!(f, " // = {}", value).map_err(|_| {
463+
write!(f, " // = {value}").map_err(|_| {
464464
SignatureError::FailedWritingSignature(
465465
constant_full_signature.full_path.clone(),
466466
)
@@ -769,7 +769,7 @@ fn extract_and_format(input: &str) -> String {
769769
let mut slice_start = 0;
770770
let mut in_slice = false;
771771

772-
for (i, c) in input.chars().enumerate() {
772+
for (i, c) in input.char_indices() {
773773
if delimiters.contains(&c) {
774774
if in_slice {
775775
let slice = &input[slice_start..i];
@@ -801,7 +801,7 @@ fn format_final_part(slice: &str) -> String {
801801
_ => slice.to_string(),
802802
}
803803
};
804-
if ensure_whitespace && !result.starts_with(' ') { format!(" {}", result) } else { result }
804+
if ensure_whitespace && !result.starts_with(' ') { format!(" {result}") } else { result }
805805
}
806806

807807
/// Takes a list of [`GenericParamId`]s and formats it into a String representation used for
@@ -825,19 +825,15 @@ fn format_resolver_generic_params(db: &dyn DocGroup, params: Vec<GenericParamId>
825825
GenericParam::Impl(generic_param_impl) => {
826826
match generic_param_impl.concrete_trait {
827827
Ok(concrete_trait) => {
828-
let concrete_trait_name = concrete_trait.name(db);
829-
let concrete_trait_generic_args_formatted =
828+
format!(
829+
"impl {param_formatted}: {}<{}>",
830+
concrete_trait.name(db),
830831
concrete_trait
831832
.generic_args(db)
832833
.iter()
833834
.map(|arg| arg.format(db))
834835
.collect::<Vec<_>>()
835-
.join(", ");
836-
format!(
837-
"impl {}: {}<{}>",
838-
param_formatted,
839-
concrete_trait_name,
840-
concrete_trait_generic_args_formatted
836+
.join(", "),
841837
)
842838
}
843839
Err(_) => param_formatted,
@@ -971,7 +967,7 @@ fn write_generic_params(
971967
Some(documentable_id),
972968
)?;
973969
if !concrete_trait_generic_args_formatted.is_empty() {
974-
write!(f, "<{}>", concrete_trait_generic_args_formatted)?;
970+
write!(f, "<{concrete_trait_generic_args_formatted}>")?;
975971
}
976972
}
977973
}

crates/cairo-lang-doc/src/parser.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl<'a> DocumentationCommentParser<'a> {
140140
} else {
141141
let text = {
142142
if is_indented_code_block {
143-
format!(" {}", text)
143+
format!(" {text}")
144144
} else {
145145
text.to_string()
146146
}
@@ -153,7 +153,7 @@ impl<'a> DocumentationCommentParser<'a> {
153153
write_list_item_prefix(&mut list_nesting, &mut tokens);
154154
prefix_list_item = false;
155155
}
156-
let complete_code = format!("`{}`", code);
156+
let complete_code = format!("`{code}`");
157157
if let Some(link) = current_link.as_mut() {
158158
link.label.push_str(&complete_code);
159159
} else {
@@ -189,8 +189,7 @@ impl<'a> DocumentationCommentParser<'a> {
189189
)));
190190
} else {
191191
tokens.push(DocumentationCommentToken::Content(format!(
192-
"\n```{}\n",
193-
language
192+
"\n```{language}\n"
194193
)));
195194
}
196195
}
@@ -266,7 +265,7 @@ impl<'a> DocumentationCommentParser<'a> {
266265
.iter()
267266
.map(|a| {
268267
let (left, right) = get_alignment_markers(a);
269-
format!("{}---{}", left, right)
268+
format!("{left}---{right}")
270269
})
271270
.join("|")
272271
)));
@@ -503,10 +502,10 @@ impl fmt::Display for DocumentationCommentToken {
503502
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
504503
match self {
505504
DocumentationCommentToken::Content(ref content) => {
506-
write!(f, "{}", content)
505+
write!(f, "{content}")
507506
}
508507
DocumentationCommentToken::Link(ref link_token) => {
509-
write!(f, "{}", link_token)
508+
write!(f, "{link_token}")
510509
}
511510
}
512511
}

crates/cairo-lang-doc/src/tests/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ impl<'a> ResultDocBuilder<'a> {
281281
.unwrap_or_default()
282282
.iter()
283283
.map(|token| match token {
284-
DocumentationCommentToken::Content(_) => format!("{:?}", token),
284+
DocumentationCommentToken::Content(_) => format!("{token:?}"),
285285
DocumentationCommentToken::Link(link_token) => {
286286
format!("{:?}", link_token.debug(self.db))
287287
}

crates/cairo-lang-executable/src/compile.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ impl std::fmt::Display for CompiledFunction {
3838
writeln!(f)?;
3939
writeln!(f, "// header")?;
4040
for instruction in &self.wrapper.header {
41-
writeln!(f, "{};", instruction)?;
41+
writeln!(f, "{instruction};")?;
4242
}
4343
writeln!(f, "// sierra based code")?;
4444
write!(f, "{}", self.program)?;
4545
writeln!(f, "// footer")?;
4646
for instruction in &self.wrapper.footer {
47-
writeln!(f, "{};", instruction)?;
47+
writeln!(f, "{instruction};")?;
4848
}
4949
Ok(())
5050
}
@@ -163,7 +163,7 @@ pub fn originating_function_path(db: &RootDatabase, wrapper: ConcreteFunctionWit
163163
let Some(wrapper_path_to_module) = wrapper_full_path.strip_suffix(wrapper_name.as_str()) else {
164164
return wrapper_full_path;
165165
};
166-
format!("{}{}", wrapper_path_to_module, wrapped_name)
166+
format!("{wrapper_path_to_module}{wrapped_name}")
167167
}
168168

169169
/// Runs compiler for an executable function.

crates/cairo-lang-lowering/src/cache/test.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ fn test_cache_check(
5959
let diagnostics =
6060
new_db.module_lowering_diagnostics(test_function.module_id).unwrap_or_default();
6161
let formatted_lowering_diagnostics = diagnostics.format(&new_db);
62-
let combined_diagnostics =
63-
format!("{}\n{}", semantic_diagnostics, formatted_lowering_diagnostics);
62+
let combined_diagnostics = format!("{semantic_diagnostics}\n{formatted_lowering_diagnostics}");
6463
let error = verify_diagnostics_expectation(args, &combined_diagnostics);
6564
TestRunnerResult {
6665
outputs: OrderedHashMap::from([

crates/cairo-lang-lowering/src/db.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ pub fn init_lowering_group(
378378
.collect();
379379

380380
for ty in ["i8", "i16", "i32", "i64", "u8", "u16", "u32", "u64"] {
381-
moveable_functions.push(format!("integer::{}_wide_mul", ty));
381+
moveable_functions.push(format!("integer::{ty}_wide_mul"));
382382
}
383383

384384
db.set_optimization_config(Arc::new(

crates/cairo-lang-lowering/src/diagnostic.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ impl MatchError {
115115
fn format(&self) -> String {
116116
match (&self.error, &self.kind) {
117117
(MatchDiagnostic::UnsupportedMatchedType(matched_type), MatchKind::Match) => {
118-
format!("Unsupported matched type. Type: `{}`.", matched_type)
118+
format!("Unsupported matched type. Type: `{matched_type}`.")
119119
}
120120
(MatchDiagnostic::UnsupportedMatchedType(matched_type), MatchKind::IfLet) => {
121-
format!("Unsupported type in if-let. Type: `{}`.", matched_type)
121+
format!("Unsupported type in if-let. Type: `{matched_type}`.")
122122
}
123123
(MatchDiagnostic::UnsupportedMatchedType(matched_type), MatchKind::WhileLet(_, _)) => {
124-
format!("Unsupported type in while-let. Type: `{}`.", matched_type)
124+
format!("Unsupported type in while-let. Type: `{matched_type}`.")
125125
}
126126
(MatchDiagnostic::UnsupportedMatchedValueTuple, MatchKind::Match) => {
127127
"Unsupported matched value. Currently, match on tuples only supports enums as \
@@ -163,7 +163,7 @@ impl MatchError {
163163
) => unreachable!("Numeric values are not supported in if/while-let conditions."),
164164

165165
(MatchDiagnostic::MissingMatchArm(variant), MatchKind::Match) => {
166-
format!("Missing match arm: `{}` not covered.", variant)
166+
format!("Missing match arm: `{variant}` not covered.")
167167
}
168168
(MatchDiagnostic::MissingMatchArm(_), MatchKind::IfLet) => {
169169
unreachable!("If-let is not required to be exhaustive.")

crates/cairo-lang-lowering/src/test.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ fn test_function_lowering(
8282
}
8383
let diagnostics = db.module_lowering_diagnostics(test_function.module_id).unwrap_or_default();
8484
let formatted_lowering_diagnostics = diagnostics.format(db);
85-
let combined_diagnostics =
86-
format!("{}\n{}", semantic_diagnostics, formatted_lowering_diagnostics);
85+
let combined_diagnostics = format!("{semantic_diagnostics}\n{formatted_lowering_diagnostics}");
8786
let error = verify_diagnostics_expectation(args, &combined_diagnostics);
8887
TestRunnerResult {
8988
outputs: OrderedHashMap::from([

crates/cairo-lang-parser/src/diagnostic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl ParserDiagnostic {
8989
SyntaxKind::TerminalUse => "use",
9090
SyntaxKind::TerminalWhile => "while",
9191
SyntaxKind::TerminalXor => "^",
92-
_ => return format!("{:?}", kind),
92+
_ => return format!("{kind:?}"),
9393
}
9494
)
9595
}

crates/cairo-lang-plugins/src/plugins/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ fn parse_predicate_item(
290290
_ => {
291291
diagnostics.push(PluginDiagnostic::error(
292292
call.stable_ptr(db),
293-
format!("Unsupported operator: `{}`.", operator),
293+
format!("Unsupported operator: `{operator}`."),
294294
));
295295
None
296296
}

crates/cairo-lang-plugins/src/plugins/external_attributes_validation.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fn get_diagnostics<Item: QueryAttrs>(
4141
if args.is_empty() {
4242
diagnostics.push(PluginDiagnostic::error(
4343
attr.stable_ptr(db),
44-
format!("Expected arguments. Supported args: {}", HIDDEN_ATTR),
44+
format!("Expected arguments. Supported args: {HIDDEN_ATTR}"),
4545
));
4646
return;
4747
}
@@ -50,7 +50,7 @@ fn get_diagnostics<Item: QueryAttrs>(
5050
let ast::Expr::Path(path) = value else {
5151
diagnostics.push(PluginDiagnostic::error(
5252
value.stable_ptr(db),
53-
format!("Expected identifier. Supported identifiers: {}", HIDDEN_ATTR),
53+
format!("Expected identifier. Supported identifiers: {HIDDEN_ATTR}"),
5454
));
5555
return;
5656
};
@@ -72,7 +72,7 @@ fn get_diagnostics<Item: QueryAttrs>(
7272
}
7373
_ => diagnostics.push(PluginDiagnostic::error(
7474
arg.arg.stable_ptr(db),
75-
format!("This argument is not supported. Supported args: {}", HIDDEN_ATTR),
75+
format!("This argument is not supported. Supported args: {HIDDEN_ATTR}"),
7676
)),
7777
});
7878
});

crates/cairo-lang-runner/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub fn token_gas_cost(token_type: CostTokenType) -> usize {
113113
| CostTokenType::Hole
114114
| CostTokenType::RangeCheck
115115
| CostTokenType::RangeCheck96 => {
116-
panic!("Token type {:?} has no gas cost.", token_type)
116+
panic!("Token type {token_type:?} has no gas cost.")
117117
}
118118
CostTokenType::Pedersen => 4050,
119119
CostTokenType::Poseidon => 491,

0 commit comments

Comments
 (0)