Skip to content

Commit 7a40b31

Browse files
committed
Revert "Use implicit capture syntax in format_args"
This reverts commit 72a25d0.
1 parent 2184c7c commit 7a40b31

File tree

177 files changed

+734
-724
lines changed

Some content is hidden

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

177 files changed

+734
-724
lines changed

compiler/rustc_errors/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,12 +1093,12 @@ impl HandlerInner {
10931093
let warnings = match self.deduplicated_warn_count {
10941094
0 => String::new(),
10951095
1 => "1 warning emitted".to_string(),
1096-
count => format!("{count} warnings emitted"),
1096+
count => format!("{} warnings emitted", count),
10971097
};
10981098
let errors = match self.deduplicated_err_count {
10991099
0 => String::new(),
11001100
1 => "aborting due to previous error".to_string(),
1101-
count => format!("aborting due to {count} previous errors"),
1101+
count => format!("aborting due to {} previous errors", count),
11021102
};
11031103
if self.treat_err_as_bug() {
11041104
return;

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3400,7 +3400,7 @@ declare_lint! {
34003400
/// // ^^^^^^^^
34013401
/// // This call to try_into matches both Foo:try_into and TryInto::try_into as
34023402
/// // `TryInto` has been added to the Rust prelude in 2021 edition.
3403-
/// println!("{x}");
3403+
/// println!("{}", x);
34043404
/// }
34053405
/// ```
34063406
///

compiler/rustc_middle/src/ty/closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ pub struct CaptureInfo {
281281
/// let mut t = (0,1);
282282
///
283283
/// let c = || {
284-
/// println!("{t}"); // L1
284+
/// println!("{}",t); // L1
285285
/// t.1 = 4; // L2
286286
/// };
287287
/// ```

compiler/rustc_typeck/src/check/upvar.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,10 +458,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
458458
/// let s: String; // hir_id_s
459459
/// let mut p: Point; // his_id_p
460460
/// let c = || {
461-
/// println!("{s}"); // L1
461+
/// println!("{}", s); // L1
462462
/// p.x += 10; // L2
463-
/// println!("{}" , p.y); // L3
464-
/// println!("{p}"); // L4
463+
/// println!("{}" , p.y) // L3
464+
/// println!("{}", p) // L4
465465
/// drop(s); // L5
466466
/// };
467467
/// ```

library/alloc/src/alloc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ pub mod __alloc_error_handler {
397397
// if there is no `#[alloc_error_handler]`
398398
#[rustc_std_internal_symbol]
399399
pub unsafe extern "C-unwind" fn __rdl_oom(size: usize, _align: usize) -> ! {
400-
panic!("memory allocation of {size} bytes failed")
400+
panic!("memory allocation of {} bytes failed", size)
401401
}
402402

403403
// if there is an `#[alloc_error_handler]`

library/alloc/src/borrow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ where
161161
/// let readonly = [1, 2];
162162
/// let borrowed = Items::new((&readonly[..]).into());
163163
/// match borrowed {
164-
/// Items { values: Cow::Borrowed(b) } => println!("borrowed {b:?}"),
164+
/// Items { values: Cow::Borrowed(b) } => println!("borrowed {:?}", b),
165165
/// _ => panic!("expect borrowed value"),
166166
/// }
167167
///

library/alloc/src/boxed.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
//! }
3232
//!
3333
//! let list: List<i32> = List::Cons(1, Box::new(List::Cons(2, Box::new(List::Nil))));
34-
//! println!("{list:?}");
34+
//! println!("{:?}", list);
3535
//! ```
3636
//!
3737
//! This will print `Cons(1, Cons(2, Nil))`.
@@ -1407,7 +1407,7 @@ impl<T: Copy> From<&[T]> for Box<[T]> {
14071407
/// let slice: &[u8] = &[104, 101, 108, 108, 111];
14081408
/// let boxed_slice: Box<[u8]> = Box::from(slice);
14091409
///
1410-
/// println!("{boxed_slice:?}");
1410+
/// println!("{:?}", boxed_slice);
14111411
/// ```
14121412
fn from(slice: &[T]) -> Box<[T]> {
14131413
let len = slice.len();
@@ -1449,7 +1449,7 @@ impl From<&str> for Box<str> {
14491449
///
14501450
/// ```rust
14511451
/// let boxed: Box<str> = Box::from("hello");
1452-
/// println!("{boxed}");
1452+
/// println!("{}", boxed);
14531453
/// ```
14541454
#[inline]
14551455
fn from(s: &str) -> Box<str> {
@@ -1474,14 +1474,14 @@ impl From<Cow<'_, str>> for Box<str> {
14741474
///
14751475
/// let unboxed = Cow::Borrowed("hello");
14761476
/// let boxed: Box<str> = Box::from(unboxed);
1477-
/// println!("{boxed}");
1477+
/// println!("{}", boxed);
14781478
/// ```
14791479
///
14801480
/// ```rust
14811481
/// # use std::borrow::Cow;
14821482
/// let unboxed = Cow::Owned("hello".to_string());
14831483
/// let boxed: Box<str> = Box::from(unboxed);
1484-
/// println!("{boxed}");
1484+
/// println!("{}", boxed);
14851485
/// ```
14861486
#[inline]
14871487
fn from(cow: Cow<'_, str>) -> Box<str> {
@@ -1528,7 +1528,7 @@ impl<T, const N: usize> From<[T; N]> for Box<[T]> {
15281528
///
15291529
/// ```rust
15301530
/// let boxed: Box<[u8]> = Box::from([4, 2]);
1531-
/// println!("{boxed:?}");
1531+
/// println!("{:?}", boxed);
15321532
/// ```
15331533
fn from(array: [T; N]) -> Box<[T]> {
15341534
box array

library/alloc/src/collections/binary_heap.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ use super::SpecExtend;
194194
/// // We can iterate over the items in the heap, although they are returned in
195195
/// // a random order.
196196
/// for x in &heap {
197-
/// println!("{x}");
197+
/// println!("{}", x);
198198
/// }
199199
///
200200
/// // If we instead pop these scores, they should come back in order.
@@ -830,7 +830,7 @@ impl<T> BinaryHeap<T> {
830830
///
831831
/// // Print 1, 2, 3, 4 in arbitrary order
832832
/// for x in heap.iter() {
833-
/// println!("{x}");
833+
/// println!("{}", x);
834834
/// }
835835
/// ```
836836
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1110,7 +1110,7 @@ impl<T> BinaryHeap<T> {
11101110
///
11111111
/// // Will print in some order
11121112
/// for x in vec {
1113-
/// println!("{x}");
1113+
/// println!("{}", x);
11141114
/// }
11151115
/// ```
11161116
#[must_use = "`self` will be dropped if the result is not used"]
@@ -1179,7 +1179,7 @@ impl<T> BinaryHeap<T> {
11791179
/// assert!(!heap.is_empty());
11801180
///
11811181
/// for x in heap.drain() {
1182-
/// println!("{x}");
1182+
/// println!("{}", x);
11831183
/// }
11841184
///
11851185
/// assert!(heap.is_empty());
@@ -1624,7 +1624,7 @@ impl<T> IntoIterator for BinaryHeap<T> {
16241624
/// // Print 1, 2, 3, 4 in arbitrary order
16251625
/// for x in heap.into_iter() {
16261626
/// // x has type i32, not &i32
1627-
/// println!("{x}");
1627+
/// println!("{}", x);
16281628
/// }
16291629
/// ```
16301630
fn into_iter(self) -> IntoIter<T> {

library/alloc/src/collections/btree/map.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ pub(super) const MIN_LEN: usize = node::MIN_LEN_AFTER_SPLIT;
104104
/// let to_find = ["Up!", "Office Space"];
105105
/// for movie in &to_find {
106106
/// match movie_reviews.get(movie) {
107-
/// Some(review) => println!("{movie}: {review}"),
108-
/// None => println!("{movie} is unreviewed.")
107+
/// Some(review) => println!("{}: {}", movie, review),
108+
/// None => println!("{} is unreviewed.", movie)
109109
/// }
110110
/// }
111111
///
@@ -114,7 +114,7 @@ pub(super) const MIN_LEN: usize = node::MIN_LEN_AFTER_SPLIT;
114114
///
115115
/// // iterate over everything.
116116
/// for (movie, review) in &movie_reviews {
117-
/// println!("{movie}: \"{review}\"");
117+
/// println!("{}: \"{}\"", movie, review);
118118
/// }
119119
/// ```
120120
///
@@ -1061,7 +1061,7 @@ impl<K, V> BTreeMap<K, V> {
10611061
/// map.insert(5, "b");
10621062
/// map.insert(8, "c");
10631063
/// for (&key, &value) in map.range((Included(&4), Included(&8))) {
1064-
/// println!("{key}: {value}");
1064+
/// println!("{}: {}", key, value);
10651065
/// }
10661066
/// assert_eq!(Some((&5, &"b")), map.range(4..).next());
10671067
/// ```
@@ -1104,7 +1104,7 @@ impl<K, V> BTreeMap<K, V> {
11041104
/// *balance += 100;
11051105
/// }
11061106
/// for (name, balance) in &map {
1107-
/// println!("{name} => {balance}");
1107+
/// println!("{} => {}", name, balance);
11081108
/// }
11091109
/// ```
11101110
#[stable(feature = "btree_range", since = "1.17.0")]
@@ -2088,7 +2088,7 @@ impl<K, V> BTreeMap<K, V> {
20882088
/// map.insert(1, "a");
20892089
///
20902090
/// for (key, value) in map.iter() {
2091-
/// println!("{key}: {value}");
2091+
/// println!("{}: {}", key, value);
20922092
/// }
20932093
///
20942094
/// let (first_key, first_value) = map.iter().next().unwrap();

library/alloc/src/collections/btree/map/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1758,7 +1758,7 @@ fn test_ord_absence() {
17581758
}
17591759

17601760
fn map_debug<K: Debug>(mut map: BTreeMap<K, ()>) {
1761-
format!("{map:?}");
1761+
format!("{:?}", map);
17621762
format!("{:?}", map.iter());
17631763
format!("{:?}", map.iter_mut());
17641764
format!("{:?}", map.keys());

0 commit comments

Comments
 (0)