// more than we want, but it's so far good enough.
unsafe {
asm!("" : : "r"(&dummy));
- return dummy;
+ dummy
}
}
level = cmp::min(*driver_level, level);
}
- return (level, src);
+ (level, src)
}
pub fn get_lint_id_level(
}
debug!("temporary_scope({:?}) = None", expr_id);
- return None;
+ None
}
/// Returns the lifetime of the variable `id`.
debug!("is_subscope_of({:?}, {:?})=true", subscope, superscope);
- return true;
+ true
}
/// Returns the ID of the innermost containing body.
_ => return None,
};
- return Some(FreeRegionInfo {
+ Some(FreeRegionInfo {
def_id: suitable_region_binding_scope,
boundregion: bound_region,
is_impl_item,
- });
+ })
}
pub fn return_type_impl_trait(&self, scope_def_id: DefId) -> Option<(Ty<'tcx>, Span)> {
(Some(sz_a_val), Some(sz_b_val)) => Err(TypeError::FixedArraySize(
expected_found(relation, &sz_a_val, &sz_b_val),
)),
- _ => return Err(err),
+ _ => Err(err),
}
}
}
}
pub fn item_def_id(&self) -> DefId {
- return self.skip_binder().item_def_id;
+ self.skip_binder().item_def_id
}
}
#[inline]
pub fn is_unsafe_ptr(&self) -> bool {
match self.kind {
- RawPtr(_) => return true,
- _ => return false,
+ RawPtr(_) => true,
+ _ => false,
}
}
self.root_ty = None;
}
- return t1;
+ t1
}
fn fold_const(&mut self, c: &'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx> {
let blkarg = cx.ident_of("_d", trait_span);
let blkdecoder = cx.expr_ident(trait_span, blkarg);
- return match *substr.fields {
+ match *substr.fields {
StaticStruct(_, ref summary) => {
let nfields = match *summary {
Unnamed(ref fields, _) => fields.len(),
)
}
_ => cx.bug("expected StaticEnum or StaticStruct in derive(Decodable)"),
- };
+ }
}
/// Creates a decoder for a single enum variant/struct:
let default_ident = cx.std_path(&[kw::Default, sym::Default, kw::Default]);
let default_call = |span| cx.expr_call_global(span, default_ident.clone(), Vec::new());
- return match *substr.fields {
+ match *substr.fields {
StaticStruct(_, ref summary) => match *summary {
Unnamed(ref fields, is_tuple) => {
if !is_tuple {
DummyResult::raw_expr(trait_span, true)
}
_ => cx.span_bug(trait_span, "method in `derive(Default)`"),
- };
+ }
}
],
));
- return match *substr.fields {
+ match *substr.fields {
Struct(_, ref fields) => {
let emit_struct_field = cx.ident_of("emit_struct_field", trait_span);
let mut stmts = Vec::new();
}
_ => cx.bug("expected Struct or EnumMatching in derive(Encodable)"),
- };
+ }
}
// set earlier; see
// librustc_expand/expand.rs:MacroExpander::fully_expand_fragment()
// librustc_expand/base.rs:Annotatable::derive_allowed()
- return;
}
}
}
//
// Note: `move` used to capture copies of the cursors as they are *now*.
let fallback = move || {
- return Some((
+ Some((
Substitution::Format(Format {
span: start.slice_between(next).unwrap(),
parameter: None,
position: InnerSpan::new(start.at, next.at),
}),
next.slice_after(),
- ));
+ ))
};
// Next parsing state.
}
// ok, don't skip this
- return false;
+ false
})
}
encoded.push(0);
}
- return encoded;
+ encoded
}
pub struct DecodedBytecode<'a> {
pub fn bytecode(&self) -> Vec<u8> {
let mut data = Vec::new();
DeflateDecoder::new(self.encoded_bytecode).read_to_end(&mut data).unwrap();
- return data;
+ data
}
pub fn identifier(&self) -> &'a str {
impl CodegenCx<'ll, 'tcx> {
pub fn const_array(&self, ty: &'ll Type, elts: &[&'ll Value]) -> &'ll Value {
- unsafe {
- return llvm::LLVMConstArray(ty, elts.as_ptr(), elts.len() as c_uint);
- }
+ unsafe { llvm::LLVMConstArray(ty, elts.as_ptr(), elts.len() as c_uint) }
}
pub fn const_vector(&self, elts: &[&'ll Value]) -> &'ll Value {
- unsafe {
- return llvm::LLVMConstVector(elts.as_ptr(), elts.len() as c_uint);
- }
+ unsafe { llvm::LLVMConstVector(elts.as_ptr(), elts.len() as c_uint) }
}
pub fn const_bytes(&self, bytes: &[u8]) -> &'ll Value {
pub fn bytes_in_context(llcx: &'ll llvm::Context, bytes: &[u8]) -> &'ll Value {
unsafe {
let ptr = bytes.as_ptr() as *const c_char;
- return llvm::LLVMConstStringInContext(llcx, ptr, bytes.len() as c_uint, True);
+ llvm::LLVMConstStringInContext(llcx, ptr, bytes.len() as c_uint, True)
}
}
ifn!("llvm.dbg.declare", fn(self.type_metadata(), self.type_metadata()) -> void);
ifn!("llvm.dbg.value", fn(self.type_metadata(), t_i64, self.type_metadata()) -> void);
}
- return None;
+ None
}
}
let key = self.unique_id_interner.intern(&unique_type_id);
self.type_to_unique_id.insert(type_, UniqueTypeId(key));
- return UniqueTypeId(key);
+ UniqueTypeId(key)
}
/// Gets the `UniqueTypeId` for an enum variant. Enum variants are not really
member_holding_stub,
member_descriptions,
);
- return MetadataCreationResult::new(metadata_stub, true);
+ MetadataCreationResult::new(metadata_stub, true)
}
}
}
)
};
- return MetadataCreationResult::new(metadata, false);
+ MetadataCreationResult::new(metadata, false)
}
fn vec_slice_metadata(
return_if_metadata_created_in_meantime!(cx, unique_type_id);
- return MetadataCreationResult::new(
+ MetadataCreationResult::new(
unsafe {
llvm::LLVMRustDIBuilderCreateSubroutineType(
DIB(cx),
)
},
false,
- );
+ )
}
// FIXME(1563): This is all a bit of a hack because 'trait pointer' is an ill-
let key = (file_name, directory);
match debug_context(cx).created_files.borrow_mut().entry(key) {
- Entry::Occupied(o) => return o.get(),
+ Entry::Occupied(o) => o.get(),
Entry::Vacant(v) => {
let (file_name, directory) = v.key();
debug!("file_metadata: file_name: {:?}, directory: {:?}", file_name, directory);
)
};
- return ty_metadata;
+ ty_metadata
}
fn foreign_type_metadata(
fn use_enum_fallback(cx: &CodegenCx<'_, '_>) -> bool {
// On MSVC we have to use the fallback mode, because LLVM doesn't
// lower variant parts to PDB.
- return cx.sess().target.target.options.is_like_msvc
+ cx.sess().target.target.options.is_like_msvc
// LLVM version 7 did not release with an important bug fix;
// but the required patch is in the LLVM 8. Rust LLVM reports
// 8 as well.
- || llvm_util::get_major_version() < 8;
+ || llvm_util::get_major_version() < 8
}
// FIXME(eddyb) maybe precompute this? Right now it's computed once
}
};
- return create_and_register_recursive_type_forward_declaration(
+ create_and_register_recursive_type_forward_declaration(
cx,
enum_type,
unique_type_id,
containing_scope,
span,
}),
- );
+ )
}
/// Creates debug information for a composite type, that is, anything that
vec![]
};
- return create_DIArray(DIB(cx), &template_params[..]);
+ create_DIArray(DIB(cx), &template_params[..])
}
fn get_parameter_names(cx: &CodegenCx<'_, '_>, generics: &ty::Generics) -> Vec<Symbol> {
#[allow(non_snake_case)]
pub fn create_DIArray(builder: &DIBuilder<'ll>, arr: &[Option<&'ll DIDescriptor>]) -> &'ll DIArray {
- return unsafe {
- llvm::LLVMRustDIBuilderGetOrCreateArray(builder, arr.as_ptr(), arr.len() as u32)
- };
+ unsafe { llvm::LLVMRustDIBuilderGetOrCreateArray(builder, arr.as_ptr(), arr.len() as u32) }
}
#[inline]
/// If this archive is used with a mutable method, then an error will be
/// raised.
pub fn open(dst: &Path) -> Result<ArchiveRO, String> {
- return unsafe {
+ unsafe {
let s = path_to_c_string(dst);
let ar = super::LLVMRustOpenArchive(s.as_ptr()).ok_or_else(|| {
super::last_error().unwrap_or_else(|| "failed to open archive".to_owned())
})?;
Ok(ArchiveRO { raw: ar })
- };
+ }
}
pub fn iter(&self) -> Iter<'_> {
for k in &self.env_remove {
ret.env_remove(k);
}
- return ret;
+ ret
}
// extensions
info.missing_lang_items.insert(cnum, missing);
}
- return info;
+ info
}
}
}
}
}
- return tcx.sess.opts.optimize;
+ tcx.sess.opts.optimize
};
providers.dllimport_foreign_items = |tcx, krate| {
} else {
self.node = Some(dom);
}
- return Some(node);
+ Some(node)
} else {
- return None;
+ None
}
}
}
PrintRequest::NativeStaticLibs => {}
}
}
- return Compilation::Stop;
+ Compilation::Stop
}
}
return true;
}
debug!("check_config: no match found");
- return false;
+ false
}
}
}
Err(err) => {
sess.err(&format!("failed to write dep-graph to `{}`: {}", path_buf.display(), err));
- return;
}
}
}
} else {
// Fast path for the common case.
self.relate(a.skip_binder(), b.skip_binder())?;
- return Ok(a.clone());
+ Ok(a.clone())
}
}
}
.span_label(span_2, String::new())
.span_label(span, span_label)
.emit();
- return Some(ErrorReported);
+ Some(ErrorReported)
}
}
let span = self.trace.cause.span;
- return self.infcx.commit_if_ok(|snapshot| {
+ self.infcx.commit_if_ok(|snapshot| {
// First, we instantiate each bound region in the supertype with a
// fresh placeholder region.
let (b_prime, placeholder_map) = self.infcx.replace_bound_vars_with_placeholders(b);
debug!("higher_ranked_sub: OK result={:?}", result);
Ok(ty::Binder::bind(result))
- });
+ })
}
}
debug!("Expanding value of {:?} from {:?} to {:?}", b_vid, cur_region, lub);
*b_data = VarValue::Value(lub);
- return true;
+ true
}
- VarValue::ErrorValue => {
- return false;
- }
+ VarValue::ErrorValue => false,
}
}
}
}
- return graph;
+ graph
}
fn collect_error_for_expanding_node(
// If sub-roots are equal, then `for_vid` and
// `vid` are related via subtyping.
debug!("TypeGeneralizer::tys: occurs check failed");
- return Err(TypeError::Mismatch);
+ Err(TypeError::Mismatch)
} else {
match variables.probe(vid) {
TypeVariableValue::Known { value: u } => {
let u = self.tcx().mk_ty_var(new_var_id);
debug!("generalize: replacing original vid={:?} with new={:?}", vid, u);
- return Ok(u);
+ Ok(u)
}
}
}
self.undo_log.push(AddVar(vid));
}
debug!("created new region variable {:?} in {:?} with origin {:?}", vid, universe, origin);
- return vid;
+ vid
}
/// Returns the universe for the given variable.
if self.first() == '\'' {
self.bump();
let kind = Char { terminated: true };
- return Literal { kind, suffix_start: self.len_consumed() };
+ Literal { kind, suffix_start: self.len_consumed() }
+ } else {
+ Lifetime { starts_with_number }
}
-
- return Lifetime { starts_with_number };
}
fn single_quoted_string(&mut self) -> bool {
})
}
- _ => return,
+ _ => {}
}
}
// Do not lint on `(..)` as that will result in the other arms being useless.
Paren(_)
// The other cases do not contain sub-patterns.
- | Wild | Rest | Lit(..) | MacCall(..) | Range(..) | Ident(.., None) | Path(..) => return,
+ | Wild | Rest | Lit(..) | MacCall(..) | Range(..) | Ident(.., None) | Path(..) => {},
// These are list-like patterns; parens can always be removed.
TupleStruct(_, ps) | Tuple(ps) | Slice(ps) | Or(ps) => for p in ps {
self.check_unused_parens_pat(cx, p, false, false);
ret = Some(cnum);
}
});
- return ret;
+ ret
}
fn verify_no_symbol_conflicts(&self, span: Span, root: &CrateRoot<'_>) {
crate fn collect(tcx: TyCtxt<'_>) -> Vec<ForeignModule> {
let mut collector = Collector { tcx, modules: Vec::new() };
tcx.hir().krate().visit_all_item_likes(&mut collector);
- return collector.modules;
+ collector.modules
}
struct Collector<'tcx> {
}
}
- return collector.args;
+ collector.args
}
struct Collector {
let start = Instant::now();
let ret = get_metadata_section_imp(target, flavor, filename, loader);
info!("reading {:?} => {:?}", filename.file_name().unwrap(), start.elapsed());
- return ret;
+ ret
}
/// A trivial wrapper for `Mmap` that implements `StableDeref`.
let mut collector = Collector { tcx, libs: Vec::new() };
tcx.hir().krate().visit_all_item_likes(&mut collector);
collector.process_command_line();
- return collector.libs;
+ collector.libs
}
crate fn relevant_lib(sess: &Session, lib: &NativeLibrary) -> bool {
.iter()
.filter_map(|&(exported_symbol, export_level)| {
if let ExportedSymbol::NonGeneric(def_id) = exported_symbol {
- return Some((def_id, export_level))
+ Some((def_id, export_level))
} else {
None
}
assert_eq!(borrow_data.borrowed_place, *place);
}
- return self.super_rvalue(rvalue, location);
+ self.super_rvalue(rvalue, location)
}
}
}
}
- return None;
+ None
}
/// We've found an enum/struct/union type with the substitutions
self.return_to_block(ret.map(|r| r.1))?;
self.dump_place(*dest);
- return Ok(true);
+ Ok(true)
}
/// "Intercept" a function call to a panic-related function
}
}
}
- return None;
+ None
}
pub struct MoveDataParamEnv<'tcx> {
return None;
}
}
- return None;
+ None
};
let print_preflow_to = name_found(tcx.sess, attributes, sym::borrowck_graphviz_preflow);
Ge => l >= r,
_ => bug!("Invalid operation on char: {:?}", bin_op),
};
- return (Scalar::from_bool(res), false, self.tcx.types.bool);
+ (Scalar::from_bool(res), false, self.tcx.types.bool)
}
fn binary_bool_op(
BitXor => l ^ r,
_ => bug!("Invalid operation on bool: {:?}", bin_op),
};
- return (Scalar::from_bool(res), false, self.tcx.types.bool);
+ (Scalar::from_bool(res), false, self.tcx.types.bool)
}
fn binary_float_op<F: Float + Into<Scalar<M::PointerTag>>>(
Rem => ((l % r).value.into(), ty),
_ => bug!("invalid float op: `{:?}`", bin_op),
};
- return (val, false, ty);
+ (val, false, ty)
}
fn binary_int_op(
if self.layout.is_unsized() {
// We need to consult `meta` metadata
match self.layout.ty.kind {
- ty::Slice(..) | ty::Str => {
- return self.mplace.meta.unwrap_meta().to_machine_usize(cx);
- }
+ ty::Slice(..) | ty::Str => self.mplace.meta.unwrap_meta().to_machine_usize(cx),
_ => bug!("len not supported on unsized type {:?}", self.layout.ty),
}
} else {
match instance.def {
ty::InstanceDef::Intrinsic(..) => {
assert!(caller_abi == Abi::RustIntrinsic || caller_abi == Abi::PlatformIntrinsic);
- return M::call_intrinsic(self, span, instance, args, ret, unwind);
+ M::call_intrinsic(self, span, instance, args, ret, unwind)
}
ty::InstanceDef::VtableShim(..)
| ty::InstanceDef::ReifyShim(..)
bug!("cannot create local mono-item for {:?}", def_id)
}
- return true;
+ true
}
/// For a given pair of source and target type that occur in an unsizing coercion,
err.span_label(source_info.span, format!("{:?}", panic));
err.emit()
});
- return None;
+ None
}
fn check_unary_op(
..
})
| Node::TraitItem(hir::TraitItem {
- kind:
- hir::TraitItemKind::Fn(hir::FnSig { decl, .. }, hir::TraitFn::Provided(body_id)),
+ kind: hir::TraitItemKind::Fn(hir::FnSig { decl, .. }, hir::TraitFn::Provided(body_id)),
..
}) => (*body_id, decl.output.span()),
Node::Item(hir::Item { kind: hir::ItemKind::Static(ty, _, body_id), .. })
}
}
- return None;
+ None
}
/// Looks at the topmost frame on the BlockContext and reports
}
}
}
- return result;
+ result
}
crate fn to_expr_ref<'a, 'tcx>(
going with stringified version"
);
}
- return tokens_for_real;
+ tokens_for_real
}
fn prepend_attrs(
let expr = self.mk_expr(lo.to(self.prev_token.span), ExprKind::Lit(literal), attrs);
self.maybe_recover_from_bad_qpath(expr, true)
}
- None => return Err(self.expected_expression_found()),
+ None => Err(self.expected_expression_found()),
}
}
}
let hi = self.token.span;
self.bump();
- return Ok(self.mk_expr(lo.to(hi), ExprKind::Match(scrutinee, arms), attrs));
+ Ok(self.mk_expr(lo.to(hi), ExprKind::Match(scrutinee, arms), attrs))
}
pub(super) fn parse_arm(&mut self) -> PResult<'a, Arm> {
" struct ".into(),
Applicability::MaybeIncorrect, // speculative
);
- return Err(err);
+ Err(err)
} else if self.look_ahead(1, |t| *t == token::OpenDelim(token::Paren)) {
let ident = self.parse_ident().unwrap();
self.bump(); // `(`
);
}
}
- return Err(err);
+ Err(err)
} else if self.look_ahead(1, |t| *t == token::Lt) {
let ident = self.parse_ident().unwrap();
self.eat_to_tokens(&[&token::Gt]);
Applicability::MachineApplicable,
);
}
- return Err(err);
+ Err(err)
} else {
Ok(())
}
let span = self.sess.source_map().def_span(span);
let msg = format!("{} is not supported in {}", kind.descr(), ctx);
self.struct_span_err(span, &msg).emit();
- return None;
+ None
}
fn error_on_foreign_const(&self, span: Span, ident: Ident) {
}
err.emit();
}
- return Ok((fields, etc));
+ Ok((fields, etc))
}
/// Recover on `...` as if it were `..` to avoid further errors.
_ => {}
}
e.span_label(sp, "expected `{`");
- return Err(e);
+ Err(e)
}
/// Parses a block. Inner attributes are allowed.
first_merge,
any_changed
);
- return any_changed;
+ any_changed
}
// Indicates that a local variable was *defined*; we know that no
return true;
}
}
- return false;
+ false
}
fn emit_unlabled_cf_in_while_condition(&mut self, span: Span, cf_type: &str) {
struct_span_err!(
}
match item.kind {
- hir::ItemKind::Fn(ref sig, ..) if sig.header.is_const() => {
- return true;
- }
+ hir::ItemKind::Fn(ref sig, ..) if sig.header.is_const() => true,
hir::ItemKind::Impl { .. } | hir::ItemKind::Fn(..) => {
let generics = tcx.generics_of(tcx.hir().local_def_id(item.hir_id));
generics.requires_monomorphization(tcx)
|v| intravisit::walk_crate(v, krate),
);
}
- return index;
+ index
}
/// Cross-references the feature names of unstable APIs with enabled
Some(_) | None => false,
}
} else {
- return false;
+ false
}
}
&& self.tcx.is_private_dep(item_id.krate);
log::debug!("leaks_private_dep(item_id={:?})={}", item_id, ret);
- return ret;
+ ret
}
}
fn visit_pat(&mut self, pat: &'a Pat) {
match pat.kind {
- PatKind::MacCall(..) => return self.visit_macro_invoc(pat.id),
+ PatKind::MacCall(..) => self.visit_macro_invoc(pat.id),
_ => visit::walk_pat(self, pat),
}
}
match binding.kind {
// Never suggest the name that has binding error
// i.e., the name that cannot be previously resolved
- NameBindingKind::Res(Res::Err, _) => return None,
+ NameBindingKind::Res(Res::Err, _) => None,
_ => Some(&i.name),
}
}
_ => (),
}
};
- return has_self_arg;
+ has_self_arg
}
fn followed_by_brace(&self, span: Span) -> (bool, Option<(Span, String)>) {
break;
}
}
- return (followed_by_brace, closing_brace);
+ (followed_by_brace, closing_brace)
}
/// Provides context-dependent help for errors reported by the `smart_resolve_path_fragment`
// line-breaks and is slow.
fn fast_print_path(path: &ast::Path) -> Symbol {
if path.segments.len() == 1 {
- return path.segments[0].ident.name;
+ path.segments[0].ident.name
} else {
let mut path_str = String::with_capacity(64);
for (i, segment) in path.segments.iter().enumerate() {
let variant = &def.non_enum_variant();
filter!(self.span_utils, ident.span);
let span = self.span_from_span(ident.span);
- return Some(Data::RefData(Ref {
+ Some(Data::RefData(Ref {
kind: RefKind::Variable,
span,
ref_id: self
.find_field_index(ident, variant)
.map(|index| id_from_def_id(variant.fields[index].did))
.unwrap_or_else(|| null_id()),
- }));
+ }))
}
ty::Tuple(..) => None,
_ => {
_ => {}
}
- return error_format;
+ error_format
}
fn parse_crate_edition(matches: &getopts::Matches) -> Edition {
cache_entry.line_end = line_bounds.1;
cache_entry.time_stamp = self.time_stamp;
- return Some((
- cache_entry.file.clone(),
- cache_entry.line_number,
- pos - cache_entry.line_start,
- ));
+ Some((cache_entry.file.clone(), cache_entry.line_number, pos - cache_entry.line_start))
}
}
// If there is a doctest offset, applies it to the line.
pub fn doctest_offset_line(&self, file: &FileName, orig: usize) -> usize {
- return match file {
+ match file {
FileName::DocTest(_, offset) => {
return if *offset >= 0 {
orig + *offset as usize
};
}
_ => orig,
- };
+ }
}
/// Looks up source information about a `BytePos`.
let local_end = self.lookup_byte_offset(sp.hi());
if local_begin.sf.start_pos != local_end.sf.start_pos {
- return Err(SpanSnippetError::DistinctSources(DistinctSources {
+ Err(SpanSnippetError::DistinctSources(DistinctSources {
begin: (local_begin.sf.name.clone(), local_begin.sf.start_pos),
end: (local_end.sf.name.clone(), local_end.sf.start_pos),
- }));
+ }))
} else {
self.ensure_source_file_source_present(local_begin.sf.clone());
}
if let Some(ref src) = local_begin.sf.src {
- return extract_source(src, start_index, end_index);
+ extract_source(src, start_index, end_index)
} else if let Some(src) = local_begin.sf.external_src.borrow().get_source() {
- return extract_source(src, start_index, end_index);
+ extract_source(src, start_index, end_index)
} else {
- return Err(SpanSnippetError::SourceNotAvailable {
- filename: local_begin.sf.name.clone(),
- });
+ Err(SpanSnippetError::SourceNotAvailable { filename: local_begin.sf.name.clone() })
}
}
}
return AutoTraitResult::ExplicitImpl;
}
- return tcx.infer_ctxt().enter(|infcx| {
+ tcx.infer_ctxt().enter(|infcx| {
let mut fresh_preds = FxHashSet::default();
// Due to the way projections are handled by SelectionContext, we need to run
let info = AutoTraitInfo { full_user_env, region_data, vid_to_region };
- return AutoTraitResult::PositiveImpl(auto_trait_callback(&infcx, info));
- });
+ AutoTraitResult::PositiveImpl(auto_trait_callback(&infcx, info))
+ })
}
}
ty, trait_did, new_env, final_user_env
);
- return Some((new_env, final_user_env));
+ Some((new_env, final_user_env))
}
/// This method is designed to work around the following issue:
}
_ => {}
}
- return true;
+ true
});
if should_add_new {
}
fn is_param_no_infer(&self, substs: SubstsRef<'_>) -> bool {
- return self.is_of_param(substs.type_at(0)) && !substs.types().any(|t| t.has_infer_types());
+ self.is_of_param(substs.type_at(0)) && !substs.types().any(|t| t.has_infer_types())
}
pub fn is_of_param(&self, ty: Ty<'_>) -> bool {
- return match ty.kind {
+ match ty.kind {
ty::Param(_) => true,
ty::Projection(p) => self.is_of_param(p.self_ty()),
_ => false,
- };
+ }
}
fn is_self_referential_projection(&self, p: ty::PolyProjectionPredicate<'_>) -> bool {
_ => panic!("Unexpected predicate {:?} {:?}", ty, predicate),
};
}
- return true;
+ true
}
pub fn clean_pred(
// we are an owner.
if orphan_check_trait_ref(tcx, trait_ref, InCrate::Local).is_ok() {
debug!("trait_ref_is_knowable: orphan check passed");
- return None;
+ None
} else {
debug!("trait_ref_is_knowable: nonlocal, nonfundamental, unowned");
- return Some(Conflict::Upstream);
+ Some(Conflict::Upstream)
}
}
}),
hir::Node::Expr(hir::Expr { .. }) => {
let parent_hid = hir.get_parent_node(hir_id);
- if parent_hid != hir_id {
- return self.describe_enclosure(parent_hid);
- } else {
- None
- }
+ if parent_hid != hir_id { self.describe_enclosure(parent_hid) } else { None }
}
_ => None,
}
// Different to previous arm because one is `&hir::Local` and the other
// is `P<hir::Local>`.
Some(hir::Node::Local(local)) => get_name(err, &local.pat.kind),
- _ => return None,
+ _ => None,
}
}
debug!("QueryNormalizer: result = {:#?}", result);
debug!("QueryNormalizer: obligations = {:#?}", obligations);
self.obligations.extend(obligations);
- return result.normalized_ty;
+ result.normalized_ty
}
Err(_) => {
self.error = true;
- return ty;
+ ty
}
}
}
}
// if we made it through that loop above, we made progress!
- return true;
+ true
}
fn nominal_obligations(
debug!("program_clauses_for_env: closure = {:#?}", closure);
- return tcx.mk_clauses(closure.into_iter());
+ tcx.mk_clauses(closure.into_iter())
}
crate fn environment(tcx: TyCtxt<'_>, def_id: DefId) -> Environment<'_> {
}
}
- return None;
+ None
}
}
return Err(ErrorReported);
}
}
- return Ok(bound);
+ Ok(bound)
}
fn complain_about_assoc_type_not_found<I>(
}
Res::Err => {
self.set_tainted_by_errors();
- return self.tcx().types.err;
+ self.tcx().types.err
}
_ => span_bug!(span, "unexpected resolution: {:?}", path.res),
}
)
.emit();
}
- return Some(r);
+ Some(r)
}
}
} else {
span_bug!(span, "unions must be ty::Adt, but got {:?}", item_type.kind);
}
- return true;
+ true
}
/// Checks that an opaque type does not contain cycles and does not use `Self` or `T::Foo`
}
Representability::Representable | Representability::ContainsRecursive => (),
}
- return true;
+ true
}
pub fn check_simd(tcx: TyCtxt<'_>, sp: Span, def_id: DefId) {
item.span,
);
}
- ty::Error => {
- return;
- }
+ ty::Error => {}
_ => {
struct_span_err!(
self.tcx.sess,
to wrap it instead",
)
.emit();
- return;
}
}
}
DUMMY_SP,
&format!("unexpected const parent path {:?}", parent_node,),
);
- return tcx.types.err;
+ tcx.types.err
}
}
},
};
ENABLED.store(enabled as usize + 1, SeqCst);
- return enabled;
+ enabled
}
/// Capture a stack backtrace of the current thread.
unsafe {
LOCK.lock();
- return Guard;
+ Guard
}
}