Skip to content

Commit 739d571

Browse files
authored
Auto merge of #36041 - ahmedcharles:try, r=nrc
Replace try! with ?.
2 parents b1363a7 + 694d601 commit 739d571

File tree

28 files changed

+105
-109
lines changed

28 files changed

+105
-109
lines changed

src/bootstrap/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use util::{exe, mtime, libdir, add_lib_path};
4545
/// * The error itself
4646
///
4747
/// This is currently used judiciously throughout the build system rather than
48-
/// using a `Result` with `try!`, but this may change on day...
48+
/// using a `Result` with `try!`, but this may change one day...
4949
macro_rules! t {
5050
($e:expr) => (match $e {
5151
Ok(e) => e,

src/libcore/num/bignum.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,9 @@ macro_rules! define_bignum {
474474
let sz = if self.size < 1 {1} else {self.size};
475475
let digitlen = mem::size_of::<$ty>() * 2;
476476

477-
try!(write!(f, "{:#x}", self.base[sz-1]));
477+
write!(f, "{:#x}", self.base[sz-1])?;
478478
for &v in self.base[..sz-1].iter().rev() {
479-
try!(write!(f, "_{:01$x}", v, digitlen));
479+
write!(f, "_{:01$x}", v, digitlen)?;
480480
}
481481
::result::Result::Ok(())
482482
}

src/librustc/hir/print.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,9 +1756,9 @@ impl<'a> State<'a> {
17561756
self.commasep(Inconsistent, &elts[ddpos..], |s, p| s.print_pat(&p))?;
17571757
}
17581758
} else {
1759-
try!(self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(&p)));
1759+
self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(&p))?;
17601760
}
1761-
try!(self.pclose());
1761+
self.pclose()?;
17621762
}
17631763
PatKind::Path(None, ref path) => {
17641764
self.print_path(path, true, 0)?;

src/librustc/infer/higher_ranked/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
130130
debug!("higher_ranked_match: skol_map={:?}", skol_map);
131131

132132
// Equate types now that bound regions have been replaced.
133-
try!(self.equate(a_is_expected).relate(&a_match, &b_match));
133+
self.equate(a_is_expected).relate(&a_match, &b_match)?;
134134

135135
// Map each skolemized region to a vector of other regions that it
136136
// must be equated with. (Note that this vector may include other

src/librustc/util/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub fn link_or_copy<P: AsRef<Path>, Q: AsRef<Path>>(p: P, q: Q) -> io::Result<Li
6868
let p = p.as_ref();
6969
let q = q.as_ref();
7070
if q.exists() {
71-
try!(fs::remove_file(&q));
71+
fs::remove_file(&q)?;
7272
}
7373

7474
match fs::hard_link(p, q) {

src/librustc_back/target/aarch64_apple_ios.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use target::{Target, TargetOptions, TargetResult};
1212
use super::apple_ios_base::{opts, Arch};
1313

1414
pub fn target() -> TargetResult {
15-
let base = try!(opts(Arch::Arm64));
15+
let base = opts(Arch::Arm64)?;
1616
Ok(Target {
1717
llvm_target: "arm64-apple-ios".to_string(),
1818
target_endian: "little".to_string(),

src/librustc_back/target/apple_ios_base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fn build_pre_link_args(arch: Arch) -> Result<Vec<String>, String> {
6868

6969
let arch_name = arch.to_string();
7070

71-
let sdk_root = try!(get_sdk_root(sdk_name));
71+
let sdk_root = get_sdk_root(sdk_name)?;
7272

7373
Ok(vec!["-arch".to_string(), arch_name.to_string(),
7474
"-Wl,-syslibroot".to_string(), sdk_root])
@@ -85,7 +85,7 @@ fn target_cpu(arch: Arch) -> String {
8585
}
8686

8787
pub fn opts(arch: Arch) -> Result<TargetOptions, String> {
88-
let pre_link_args = try!(build_pre_link_args(arch));
88+
let pre_link_args = build_pre_link_args(arch)?;
8989
Ok(TargetOptions {
9090
cpu: target_cpu(arch),
9191
dynamic_linking: false,

src/librustc_back/target/armv7_apple_ios.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use target::{Target, TargetOptions, TargetResult};
1212
use super::apple_ios_base::{opts, Arch};
1313

1414
pub fn target() -> TargetResult {
15-
let base = try!(opts(Arch::Armv7));
15+
let base = opts(Arch::Armv7)?;
1616
Ok(Target {
1717
llvm_target: "armv7-apple-ios".to_string(),
1818
target_endian: "little".to_string(),

src/librustc_back/target/armv7s_apple_ios.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use target::{Target, TargetOptions, TargetResult};
1212
use super::apple_ios_base::{opts, Arch};
1313

1414
pub fn target() -> TargetResult {
15-
let base = try!(opts(Arch::Armv7s));
15+
let base = opts(Arch::Armv7s)?;
1616
Ok(Target {
1717
llvm_target: "armv7s-apple-ios".to_string(),
1818
target_endian: "little".to_string(),

src/librustc_back/target/i386_apple_ios.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use target::{Target, TargetOptions, TargetResult};
1212
use super::apple_ios_base::{opts, Arch};
1313

1414
pub fn target() -> TargetResult {
15-
let base = try!(opts(Arch::I386));
15+
let base = opts(Arch::I386)?;
1616
Ok(Target {
1717
llvm_target: "i386-apple-ios".to_string(),
1818
target_endian: "little".to_string(),

0 commit comments

Comments
 (0)