Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/librustc_builtin_macros/deriving/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1056,8 +1056,9 @@ impl<'a> MethodDef<'a> {
self_: field,
other: other_fields
.iter_mut()
.map(|l| match l.next().unwrap() {
(.., ex, _) => ex,
.map(|l| {
let (.., ex, _) = l.next().unwrap();
ex
})
.collect(),
attrs,
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_span/source_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,11 +370,11 @@ impl SourceMap {
pub fn doctest_offset_line(&self, file: &FileName, orig: usize) -> usize {
match file {
FileName::DocTest(_, offset) => {
return if *offset >= 0 {
orig + *offset as usize
} else {
if *offset < 0 {
orig - (-(*offset)) as usize
};
} else {
orig + *offset as usize
}
}
_ => orig,
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/apple_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub fn macos_link_env_remove() -> Vec<String> {
let mut env_remove = Vec::with_capacity(2);
// Remove the `SDKROOT` environment variable if it's clearly set for the wrong platform, which
// may occur when we're linking a custom build script while targeting iOS for example.
if let Some(sdkroot) = env::var("SDKROOT").ok() {
if let Ok(sdkroot) = env::var("SDKROOT") {
if sdkroot.contains("iPhoneOS.platform") || sdkroot.contains("iPhoneSimulator.platform") {
env_remove.push("SDKROOT".to_string())
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_target/spec/apple_sdk_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub fn get_sdk_root(sdk_name: &str) -> Result<String, String> {
// to allow the SDK path to be set. (For clang, xcrun sets
// SDKROOT; for rustc, the user or build system can set it, or we
// can fall back to checking for xcrun on PATH.)
if let Some(sdkroot) = env::var("SDKROOT").ok() {
if let Ok(sdkroot) = env::var("SDKROOT") {
let p = Path::new(&sdkroot);
match sdk_name {
// Ignore `SDKROOT` if it's clearly set for the wrong platform.
Expand Down
23 changes: 13 additions & 10 deletions src/librustc_typeck/check/method/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let fn_sig = tcx.fn_sig(def_id);
let fn_sig = self.replace_bound_vars_with_fresh_vars(span, infer::FnCall, &fn_sig).0;
let fn_sig = fn_sig.subst(self.tcx, substs);
let fn_sig = match self.normalize_associated_types_in_as_infer_ok(span, &fn_sig) {
InferOk { value, obligations: o } => {
obligations.extend(o);
value
}

let InferOk { value, obligations: o } =
self.normalize_associated_types_in_as_infer_ok(span, &fn_sig);
let fn_sig = {
obligations.extend(o);
value
};

// Register obligations for the parameters. This will include the
Expand All @@ -384,12 +385,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// Note that as the method comes from a trait, it should not have
// any late-bound regions appearing in its bounds.
let bounds = self.tcx.predicates_of(def_id).instantiate(self.tcx, substs);
let bounds = match self.normalize_associated_types_in_as_infer_ok(span, &bounds) {
InferOk { value, obligations: o } => {
obligations.extend(o);
value
}

let InferOk { value, obligations: o } =
self.normalize_associated_types_in_as_infer_ok(span, &bounds);
let bounds = {
obligations.extend(o);
value
};

assert!(!bounds.has_escaping_bound_vars());

let cause = traits::ObligationCause::misc(span, self.body_id);
Expand Down
4 changes: 1 addition & 3 deletions src/librustdoc/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,7 @@ pub fn load_css_paths(v: &[u8]) -> CssPath {
}

pub fn get_differences(against: &CssPath, other: &CssPath, v: &mut Vec<String>) {
if against.name != other.name {
return;
} else {
if against.name == other.name {
for child in &against.children {
let mut found = false;
let mut found_working = false;
Expand Down