Skip to content

Commit d002bbd

Browse files
cjlongoriafacebook-github-bot
authored andcommitted
Edition 2024 cleanup: rename expr_2021 -> expr
Summary: X-link: meta-pytorch/monarch#949 This renames `expr_2021` to `expr` for rust macros. The `expr_2021` was used during the Rust Edition upgrade to ensure compatibility between the two editions. Now that we are using Rust Edition 2024 as the default, and none of the macros are triggering a build failure with this rename, we can rename this back to `expr` Reviewed By: diliop Differential Revision: D80508019 fbshipit-source-id: 5ebdc9a11067ff66d2ec475790e9df97a6e1fa46
1 parent 406d5ac commit d002bbd

File tree

11 files changed

+21
-21
lines changed

11 files changed

+21
-21
lines changed

crates/base_db/src/test_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ pub use dissimilar::diff as __diff;
2222
/// `eprintln!()` macro in case of text inequality.
2323
#[macro_export]
2424
macro_rules! assert_eq_text {
25-
($left:expr_2021, $right:expr_2021) => {
25+
($left:expr, $right:expr) => {
2626
assert_eq_text!($left, $right,)
2727
};
28-
($left:expr_2021, $right:expr_2021, $($tt:tt)*) => {{
28+
($left:expr, $right:expr, $($tt:tt)*) => {{
2929
let left = $left;
3030
let right = $right;
3131
if left != right {

crates/elp/src/bin/lint_cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ mod tests {
950950
use crate::args::Command;
951951

952952
macro_rules! args_vec {
953-
($($e:expr_2021$(,)?)+) => {
953+
($($e:expr$(,)?)+) => {
954954
vec![$(OsString::from($e),)+]
955955
}
956956
}

crates/elp/src/bin/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ mod tests {
237237
const BUCK_QUERY_CONFIG: BuckQueryConfig = BuckQueryConfig::BuildGeneratedCode;
238238

239239
macro_rules! args_vec {
240-
($($e:expr_2021$(,)?)+) => {
240+
($($e:expr$(,)?)+) => {
241241
vec![$(OsString::from($e),)+]
242242
}
243243
}

crates/elp/src/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ pub struct EqwalizerConfig {
143143
}
144144

145145
macro_rules! try_ {
146-
($expr:expr_2021) => {
146+
($expr:expr) => {
147147
|| -> _ { Some($expr) }()
148148
};
149149
}
150150
macro_rules! try_or {
151-
($expr:expr_2021, $or:expr_2021) => {
151+
($expr:expr, $or:expr) => {
152152
try_!($expr).unwrap_or($or)
153153
};
154154
}
@@ -401,7 +401,7 @@ macro_rules! _config_data {
401401
(struct $name:ident {
402402
$(
403403
$(#[doc=$doc:literal])*
404-
$field:ident $(| $alias:ident)*: $ty:ty = $default:expr_2021,
404+
$field:ident $(| $alias:ident)*: $ty:ty = $default:expr,
405405
)*
406406
}) => {
407407
#[allow(non_snake_case)]

crates/elp_log/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl Log for Logger {
128128
/// so `drop` happens at the end of the function
129129
#[macro_export]
130130
macro_rules! timeit {
131-
($display:expr_2021) => {
131+
($display:expr) => {
132132
$crate::TimeIt::new(module_path!(), $display, $crate::Telemetry::No)
133133
};
134134
($($arg:tt)+) => {
@@ -140,7 +140,7 @@ macro_rules! timeit {
140140
/// Same as timeit!, but also send a LSP telemetry/event
141141
#[macro_export]
142142
macro_rules! timeit_with_telemetry {
143-
($display:expr_2021) => {
143+
($display:expr) => {
144144
$crate::TimeIt::new(module_path!(), $display, $crate::Telemetry::Always)
145145
};
146146
($($arg:tt)+) => {
@@ -152,7 +152,7 @@ macro_rules! timeit_with_telemetry {
152152
/// Same as timeit_with_telemetry!, but do work only if latency is more than configured value
153153
#[macro_export]
154154
macro_rules! timeit_exceeds {
155-
($display:expr_2021, $duration:expr_2021) => {
155+
($display:expr, $duration:expr) => {
156156
$crate::TimeIt::new(
157157
module_path!(),
158158
$display,

crates/hir/src/body/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2436,7 +2436,7 @@ fn triple_quoted_strings_2() {
24362436
// - Proper location reporting for failing tests
24372437
macro_rules! my_expect {
24382438
[$data:literal] => { $crate::expect![[$data]] };
2439-
[[$data:expr_2021]] => {expect_test::Expect {
2439+
[[$data:expr]] => {expect_test::Expect {
24402440
position: expect_test::Position {
24412441
file: file!(),
24422442
line: line!(),

crates/ide_db/src/rename.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ impl fmt::Display for RenameError {
4242

4343
#[macro_export]
4444
macro_rules! _format_err {
45-
($fmt:expr_2021) => { RenameError(format!($fmt)) };
46-
($fmt:expr_2021, $($arg:tt)+) => { RenameError(format!($fmt, $($arg)+)) }
45+
($fmt:expr) => { RenameError(format!($fmt)) };
46+
($fmt:expr, $($arg:tt)+) => { RenameError(format!($fmt, $($arg)+)) }
4747
}
4848
pub use _format_err as format_err;
4949

crates/ide_ssr/src/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
1313
/// Constructs an SsrError taking arguments like the format macro.
1414
macro_rules! _error {
15-
($fmt:expr_2021) => {$crate::SsrError::new(format!($fmt))};
16-
($fmt:expr_2021, $($arg:tt)+) => {$crate::SsrError::new(format!($fmt, $($arg)+))}
15+
($fmt:expr) => {$crate::SsrError::new(format!($fmt))};
16+
($fmt:expr, $($arg:tt)+) => {$crate::SsrError::new(format!($fmt, $($arg)+))}
1717
}
1818
#[allow(unused_imports)]
1919
pub(crate) use _error as error;

crates/ide_ssr/src/matching.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ use crate::get_literal_subid;
6363

6464
// Creates a match error.
6565
macro_rules! match_error {
66-
($e:expr_2021) => {{
66+
($e:expr) => {{
6767
MatchFailed {
6868
reason: if recording_match_fail_reasons() {
6969
Some(format!("{}", $e))
@@ -72,7 +72,7 @@ macro_rules! match_error {
7272
}
7373
}
7474
}};
75-
($fmt:expr_2021, $($arg:tt)+) => {{
75+
($fmt:expr, $($arg:tt)+) => {{
7676
MatchFailed {
7777
reason: if recording_match_fail_reasons() {
7878
Some(format!($fmt, $($arg)+))

crates/syntax/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,9 @@ impl SourceFile {
374374
macro_rules! match_ast {
375375
(match $node:ident { $($tt:tt)* }) => { match_ast!(match ($node) { $($tt)* }) };
376376

377-
(match ($node:expr_2021) {
378-
$( ast::$ast:ident($it:pat) => $res:expr_2021, )*
379-
_ => $catch_all:expr_2021 $(,)?
377+
(match ($node:expr) {
378+
$( ast::$ast:ident($it:pat) => $res:expr, )*
379+
_ => $catch_all:expr $(,)?
380380
}) => {{
381381
$( if let Some($it) = ast::$ast::cast($node.clone()) { $res } else )*
382382
{ $catch_all }

0 commit comments

Comments
 (0)