Skip to content

Commit 5a45824

Browse files
committed
Tidy
1 parent 01b74c5 commit 5a45824

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,9 @@ pub fn lower_crate<'a, 'hir>(
324324
lifetimes_to_define: Vec::new(),
325325
is_collecting_in_band_lifetimes: false,
326326
in_scope_lifetimes: Vec::new(),
327-
allow_try_trait: Some([sym::try_trait, sym::try_trait_v2, sym::control_flow_enum][..].into()),
327+
allow_try_trait: Some(
328+
[sym::try_trait, sym::try_trait_v2, sym::control_flow_enum][..].into(),
329+
),
328330
allow_gen_future: Some([sym::gen_future][..].into()),
329331
}
330332
.lower_crate(krate)

library/core/src/iter/traits/iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
// can't split that into multiple files.
44

55
use crate::cmp::{self, Ordering};
6-
use crate::ops::{self, Add, ControlFlow, Try};
76
#[cfg(not(bootstrap))]
87
use crate::ops::FromResidual;
8+
use crate::ops::{self, Add, ControlFlow, Try};
99

1010
use super::super::TrustedRandomAccess;
1111
use super::super::{Chain, Cloned, Copied, Cycle, Enumerate, Filter, FilterMap, Fuse};

library/core/src/ops/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ pub use self::range::{Bound, RangeBounds, RangeInclusive, RangeToInclusive};
185185
pub use self::r#try::Try2015;
186186

187187
#[unstable(feature = "try_trait_v2", issue = "42327")]
188-
pub use self::r#try::{GetCorrespondingTryType, FromResidual, Try2021};
188+
pub use self::r#try::{FromResidual, GetCorrespondingTryType, Try2021};
189189

190190
#[cfg(bootstrap)]
191191
#[unstable(feature = "try_trait_v2", issue = "42327")]

library/core/src/ops/try.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ pub trait Try2021: FromResidual {
110110

111111
/// Demonstration that this is usable for different-return-type scenarios (like `Iterator::try_find`).
112112
#[unstable(feature = "try_trait_v2", issue = "42327")]
113-
fn map<T>(self, f: impl FnOnce(Self::Ok) -> T) -> <Self::Residual as GetCorrespondingTryType<T>>::Output
113+
fn map<T>(
114+
self,
115+
f: impl FnOnce(Self::Ok) -> T,
116+
) -> <Self::Residual as GetCorrespondingTryType<T>>::Output
114117
where
115118
Self: Try2021,
116119
Self::Residual: GetCorrespondingTryType<T>,

src/test/ui/try-trait/try-non-generic-type.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ impl FromResidual for ResultCode {
4040

4141
impl<T, E: From<FancyError>> FromResidual<ResultCodeResidual> for Result<T, E> {
4242
fn from_residual(r: ResultCodeResidual) -> Self {
43-
Err(FancyError(format!("Something fancy about {} at {:?}", r.0, std::time::SystemTime::now())).into())
43+
Err(FancyError(format!(
44+
"Something fancy about {} at {:?}",
45+
r.0,
46+
std::time::SystemTime::now()
47+
))
48+
.into())
4449
}
4550
}
4651

0 commit comments

Comments
 (0)