diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index d98055edf85c64874f761800079dd2c4a57d49d1..95838e03d2378858b99c70b086a69a1fee68e663 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -312,10 +312,10 @@ fn collect_tests_from_dir(config: &Config, } else if file_path.is_dir() { let relative_file_path = relative_dir_path.join(file.file_name()); collect_tests_from_dir(config, - base, - &file_path, - &relative_file_path, - tests)?; + base, + &file_path, + relative_file_path, + tests)?; } } Ok(()) diff --git a/src/librustc/middle/def_id.rs b/src/librustc/middle/def_id.rs index 98fdcc65835fe83ae25a4c4a14b4bf2f929b7dd2..f5bdf28a4b134032031a26c9e3fcb07640837c82 100644 --- a/src/librustc/middle/def_id.rs +++ b/src/librustc/middle/def_id.rs @@ -56,7 +56,7 @@ pub struct DefId { impl fmt::Debug for DefId { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "DefId {{ krate: {:?}, node: {:?}", - self.krate, self.index)?; + self.krate, self.index)?; // Unfortunately, there seems to be no way to attempt to print // a path for a def-id, so I'll just make a best effort for now diff --git a/src/librustc/middle/infer/combine.rs b/src/librustc/middle/infer/combine.rs index cbb5586f720c5d4cc3ff7b44b3352ae108229e93..f67389e3c3b008b0d91dc8ae71ca76d9274369d6 100644 --- a/src/librustc/middle/infer/combine.rs +++ b/src/librustc/middle/infer/combine.rs @@ -71,9 +71,9 @@ pub fn super_combine_tys<'a,'tcx:'a,R>(infcx: &InferCtxt<'a, 'tcx>, // Relate integral variables to other types (&ty::TyInfer(ty::IntVar(a_id)), &ty::TyInfer(ty::IntVar(b_id))) => { infcx.int_unification_table - .borrow_mut() - .unify_var_var(a_id, b_id) - .map_err(|e| int_unification_error(a_is_expected, e))?; + .borrow_mut() + .unify_var_var(a_id, b_id) + .map_err(|e| int_unification_error(a_is_expected, e))?; Ok(a) } (&ty::TyInfer(ty::IntVar(v_id)), &ty::TyInt(v)) => { @@ -92,9 +92,9 @@ pub fn super_combine_tys<'a,'tcx:'a,R>(infcx: &InferCtxt<'a, 'tcx>, // Relate floating-point variables to other types (&ty::TyInfer(ty::FloatVar(a_id)), &ty::TyInfer(ty::FloatVar(b_id))) => { infcx.float_unification_table - .borrow_mut() - .unify_var_var(a_id, b_id) - .map_err(|e| float_unification_error(relation.a_is_expected(), e))?; + .borrow_mut() + .unify_var_var(a_id, b_id) + .map_err(|e| float_unification_error(relation.a_is_expected(), e))?; Ok(a) } (&ty::TyInfer(ty::FloatVar(v_id)), &ty::TyFloat(v)) => { @@ -123,8 +123,7 @@ fn unify_integral_variable<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>, val: ty::IntVarValue) -> RelateResult<'tcx, Ty<'tcx>> { - infcx - .int_unification_table + infcx.int_unification_table .borrow_mut() .unify_var_value(vid, val) .map_err(|e| int_unification_error(vid_is_expected, e))?; @@ -140,8 +139,7 @@ fn unify_float_variable<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>, val: ast::FloatTy) -> RelateResult<'tcx, Ty<'tcx>> { - infcx - .float_unification_table + infcx.float_unification_table .borrow_mut() .unify_var_value(vid, val) .map_err(|e| float_unification_error(vid_is_expected, e))?; diff --git a/src/librustc/middle/infer/sub.rs b/src/librustc/middle/infer/sub.rs index 34b9953c529ec2b01c3d9eded1cd8a16282dc77e..e94311697c35a9c30dd238f3b26cdd43373a5263 100644 --- a/src/librustc/middle/infer/sub.rs +++ b/src/librustc/middle/infer/sub.rs @@ -76,8 +76,8 @@ fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> { } (&ty::TyInfer(TyVar(a_id)), _) => { self.fields - .switch_expected() - .instantiate(b, SupertypeOf, a_id)?; + .switch_expected() + .instantiate(b, SupertypeOf, a_id)?; Ok(a) } (_, &ty::TyInfer(TyVar(b_id))) => { diff --git a/src/librustc/middle/traits/select.rs b/src/librustc/middle/traits/select.rs index ffef509de958a78bd6977f0f433c6267ceea64c4..3eaf123e5be58f3265a28f5d78143df2cd8fe768 100644 --- a/src/librustc/middle/traits/select.rs +++ b/src/librustc/middle/traits/select.rs @@ -1038,15 +1038,15 @@ fn assemble_candidates<'o>(&mut self, // For other types, we'll use the builtin rules. self.assemble_builtin_bound_candidates(ty::BoundCopy, - obligation, - &mut candidates)?; + obligation, + &mut candidates)?; } Some(bound @ ty::BoundSized) => { // Sized is never implementable by end-users, it is // always automatically computed. self.assemble_builtin_bound_candidates(bound, - obligation, - &mut candidates)?; + obligation, + &mut candidates)?; } None if self.tcx().lang_items.unsize_trait() == @@ -2422,8 +2422,8 @@ fn confirm_fn_pointer_candidate(&mut self, .map_bound(|(trait_ref, _)| trait_ref); self.confirm_poly_trait_refs(obligation.cause.clone(), - obligation.predicate.to_poly_trait_ref(), - trait_ref)?; + obligation.predicate.to_poly_trait_ref(), + trait_ref)?; Ok(self_ty) } @@ -2450,8 +2450,8 @@ fn confirm_closure_candidate(&mut self, obligations); self.confirm_poly_trait_refs(obligation.cause.clone(), - obligation.predicate.to_poly_trait_ref(), - trait_ref)?; + obligation.predicate.to_poly_trait_ref(), + trait_ref)?; Ok(VtableClosureData { closure_def_id: closure_def_id, diff --git a/src/librustc/middle/ty/relate.rs b/src/librustc/middle/ty/relate.rs index b67fee7239b54664f0182d75006c70be332e3ded..1df7a440f4f16d5ba88e6072f1e54dd7cd1c1404 100644 --- a/src/librustc/middle/ty/relate.rs +++ b/src/librustc/middle/ty/relate.rs @@ -167,9 +167,9 @@ pub fn relate_substs<'a,'tcx:'a,R>(relation: &mut R, let b_regions = b.get_slice(space); let r_variances = variances.map(|v| v.regions.get_slice(space)); let regions = relate_region_params(relation, - r_variances, - a_regions, - b_regions)?; + r_variances, + a_regions, + b_regions)?; substs.mut_regions().replace(space, regions); } } @@ -261,8 +261,8 @@ fn relate(relation: &mut R, } let inputs = relate_arg_vecs(relation, - &a.inputs, - &b.inputs)?; + &a.inputs, + &b.inputs)?; let output = match (a.output, b.output) { (ty::FnConverging(a_ty), ty::FnConverging(b_ty)) => @@ -557,8 +557,8 @@ pub fn super_relate_tys<'a,'tcx:'a,R>(relation: &mut R, { if as_.len() == bs.len() { let ts = as_.iter().zip(bs) - .map(|(a, b)| relation.relate(a, b)) - .collect::>()?; + .map(|(a, b)| relation.relate(a, b)) + .collect::>()?; Ok(tcx.mk_tup(ts)) } else if !(as_.is_empty() || bs.is_empty()) { Err(TypeError::TupleSize( diff --git a/src/librustc/mir/repr.rs b/src/librustc/mir/repr.rs index 8c4a91bd88d4bfeeb3864618b48a15347723db37..ff3e292f45818c4245982fc941740a89842ee107 100644 --- a/src/librustc/mir/repr.rs +++ b/src/librustc/mir/repr.rs @@ -809,8 +809,8 @@ fn fmt_tuple(fmt: &mut Formatter, lvs: &[Operand]) -> fmt::Result { let variant_def = &adt_def.variants[variant]; ppaux::parameterized(fmt, substs, variant_def.did, - ppaux::Ns::Value, &[], - |tcx| { + ppaux::Ns::Value, &[], + |tcx| { tcx.lookup_item_type(variant_def.did).generics })?; diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index cdf8912a3c4b0c9a6e988840dabe941feaf1c4bd..64619e40f49414c34092a11edf4e6ee66f4a8b98 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -123,8 +123,8 @@ pub fn parameterized(f: &mut fmt::Formatter, for projection in projections { start_or_continue(f, "<", ", ")?; write!(f, "{}={}", - projection.projection_ty.item_name, - projection.ty)?; + projection.projection_ty.item_name, + projection.ty)?; } return start_or_continue(f, "", ">"); } @@ -201,8 +201,8 @@ pub fn parameterized(f: &mut fmt::Formatter, for projection in projections { start_or_continue(f, "<", ", ")?; write!(f, "{}={}", - projection.projection_ty.item_name, - projection.ty)?; + projection.projection_ty.item_name, + projection.ty)?; } start_or_continue(f, "", ">")?; @@ -865,7 +865,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{} {{", bare_fn.sig.0)?; parameterized(f, substs, def_id, Ns::Value, &[], - |tcx| tcx.lookup_item_type(def_id).generics)?; + |tcx| tcx.lookup_item_type(def_id).generics)?; write!(f, "}}") } TyFnPtr(ref bare_fn) => { diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs index 3fc19f9bed562e25aacdc3db8947e125b77815d5..a8eac524971ba7107a1d242fdb744ee1b33100a6 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs @@ -468,7 +468,7 @@ fn load_file(path: &Path) -> Result { let mut contents = Vec::new(); f.read_to_end(&mut contents).map_err(|e| e.to_string())?; let obj = json::from_reader(&mut &contents[..]) - .map_err(|e| e.to_string())?; + .map_err(|e| e.to_string())?; Ok(Target::from_json(obj)) } diff --git a/src/librustc_borrowck/borrowck/mir/graphviz.rs b/src/librustc_borrowck/borrowck/mir/graphviz.rs index b1d3b215ab4ed9c83c29bda95d201699abd9264c..460c71dee3d721e6f00b1d0cc125ccda7a3ad2c8 100644 --- a/src/librustc_borrowck/borrowck/mir/graphviz.rs +++ b/src/librustc_borrowck/borrowck/mir/graphviz.rs @@ -124,15 +124,15 @@ fn chunked_present_left(w: &mut W, write!(w, "")?; } write!(w, "{objs:?}", - bg = BG_FLOWCONTENT, - align = ALIGN_RIGHT, - objs = c)?; + bg = BG_FLOWCONTENT, + align = ALIGN_RIGHT, + objs = c)?; seen_one = true; } if !seen_one { write!(w, "[]", - bg = BG_FLOWCONTENT, - align = ALIGN_RIGHT)?; + bg = BG_FLOWCONTENT, + align = ALIGN_RIGHT)?; } Ok(()) } @@ -155,18 +155,18 @@ fn chunked_present_left(w: &mut W, let kill = flow.interpret_set(flow.sets.kill_set_for(i)); chunked_present_left(w, &gen[..], chunk_size)?; write!(w, " = GEN:{genbits:?}\ - ", - bg = BG_FLOWCONTENT, - face = FACE_MONOSPACE, - genbits=bits_to_string( flow.sets.gen_set_for(i), - flow.sets.bytes_per_block()))?; + ", + bg = BG_FLOWCONTENT, + face = FACE_MONOSPACE, + genbits=bits_to_string( flow.sets.gen_set_for(i), + flow.sets.bytes_per_block()))?; write!(w, "KILL:\ - {killbits:?}", - bg = BG_FLOWCONTENT, - align = ALIGN_RIGHT, - face = FACE_MONOSPACE, - killbits=bits_to_string(flow.sets.kill_set_for(i), - flow.sets.bytes_per_block()))?; + {killbits:?}", + bg = BG_FLOWCONTENT, + align = ALIGN_RIGHT, + face = FACE_MONOSPACE, + killbits=bits_to_string(flow.sets.kill_set_for(i), + flow.sets.bytes_per_block()))?; // (chunked_present_right) let mut seen_one = false; @@ -174,19 +174,19 @@ fn chunked_present_left(w: &mut W, if !seen_one { // continuation of row; this is fourth write!(w, "= {kill:?}", - bg = BG_FLOWCONTENT, - kill=k)?; + bg = BG_FLOWCONTENT, + kill=k)?; } else { // new row, with indent of three 's write!(w, "{kill:?}", - bg = BG_FLOWCONTENT, - kill=k)?; + bg = BG_FLOWCONTENT, + kill=k)?; } seen_one = true; } if !seen_one { write!(w, "= []", - bg = BG_FLOWCONTENT)?; + bg = BG_FLOWCONTENT)?; } Ok(()) diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index c64e6d1801d296385e9761ea171d0f0b6290f2a9..55b873c06630a2b1bb5018efc635fe8ceec1b26f 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -100,10 +100,10 @@ pub fn compile_input(sess: &Session, let outputs = build_output_filenames(input, outdir, output, &krate.attrs, sess); let id = link::find_crate_name(Some(sess), &krate.attrs, input); let expanded_crate = phase_2_configure_and_expand(sess, - &cstore, - krate, - &id[..], - addl_plugins)?; + &cstore, + krate, + &id[..], + addl_plugins)?; (outputs, expanded_crate, id) }; @@ -169,12 +169,12 @@ pub fn compile_input(sess: &Session, }; phase_3_run_analysis_passes(sess, - &cstore, - hir_map, - &arenas, - &id, - control.make_glob_map, - |tcx, mir_map, analysis, result| { + &cstore, + hir_map, + &arenas, + &id, + control.make_glob_map, + |tcx, mir_map, analysis, result| { { // Eventually, we will want to track plugins. let _ignore = tcx.dep_graph.in_ignore(); @@ -683,8 +683,8 @@ pub fn phase_2_configure_and_expand(sess: &Session, })?; time(time_passes, - "const fn bodies and arguments", - || const_fn::check_crate(sess, &krate))?; + "const fn bodies and arguments", + || const_fn::check_crate(sess, &krate))?; if sess.opts.debugging_opts.input_stats { println!("Post-expansion node count: {}", count_nodes(&krate)); @@ -781,10 +781,10 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session, }; let named_region_map = time(time_passes, - "lifetime resolution", - || middle::resolve_lifetime::krate(sess, - &hir_map, - &def_map.borrow()))?; + "lifetime resolution", + || middle::resolve_lifetime::krate(sess, + &hir_map, + &def_map.borrow()))?; time(time_passes, "looking for entry point", diff --git a/src/librustc_front/print/pprust.rs b/src/librustc_front/print/pprust.rs index a647ba8b57cf887743ec1d3a6191d45a5a419a69..3b8e6763de011a7d3bb1aae09250331e9a430658 100644 --- a/src/librustc_front/print/pprust.rs +++ b/src/librustc_front/print/pprust.rs @@ -288,13 +288,13 @@ pub fn fun_to_string(decl: &hir::FnDecl, to_string(|s| { s.head("")?; s.print_fn(decl, - unsafety, - constness, - Abi::Rust, - Some(name), - generics, - opt_explicit_self, - hir::Inherited)?; + unsafety, + constness, + Abi::Rust, + Some(name), + generics, + opt_explicit_self, + hir::Inherited)?; s.end()?; // Close the head box s.end() // Close the outer box }) @@ -567,13 +567,13 @@ pub fn print_foreign_item(&mut self, item: &hir::ForeignItem) -> io::Result<()> hir::ForeignItemFn(ref decl, ref generics) => { self.head("")?; self.print_fn(decl, - hir::Unsafety::Normal, - hir::Constness::NotConst, - Abi::Rust, - Some(item.name), - generics, - None, - item.vis)?; + hir::Unsafety::Normal, + hir::Constness::NotConst, + Abi::Rust, + Some(item.name), + generics, + None, + item.vis)?; self.end()?; // end head-ibox word(&mut self.s, ";")?; self.end() // end the outer fn box @@ -704,13 +704,13 @@ pub fn print_item(&mut self, item: &hir::Item) -> io::Result<()> { hir::ItemFn(ref decl, unsafety, constness, abi, ref typarams, ref body) => { self.head("")?; self.print_fn(decl, - unsafety, - constness, - abi, - Some(item.name), - typarams, - None, - item.vis)?; + unsafety, + constness, + abi, + Some(item.name), + typarams, + None, + item.vis)?; word(&mut self.s, " ")?; self.print_block_with_attrs(&body, &item.attrs)?; } @@ -984,9 +984,9 @@ pub fn print_trait_item(&mut self, ti: &hir::TraitItem) -> io::Result<()> { match ti.node { hir::ConstTraitItem(ref ty, ref default) => { self.print_associated_const(ti.name, - &ty, - default.as_ref().map(|expr| &**expr), - hir::Inherited)?; + &ty, + default.as_ref().map(|expr| &**expr), + hir::Inherited)?; } hir::MethodTraitItem(ref sig, ref body) => { if body.is_some() { @@ -1002,8 +1002,8 @@ pub fn print_trait_item(&mut self, ti: &hir::TraitItem) -> io::Result<()> { } hir::TypeTraitItem(ref bounds, ref default) => { self.print_associated_type(ti.name, - Some(bounds), - default.as_ref().map(|ty| &**ty))?; + Some(bounds), + default.as_ref().map(|ty| &**ty))?; } } self.ann.post(self, NodeSubItem(ti.id)) @@ -1219,15 +1219,15 @@ fn print_expr_struct(&mut self, self.print_path(path, true, 0)?; word(&mut self.s, "{")?; self.commasep_cmnt(Consistent, - &fields[..], - |s, field| { - s.ibox(indent_unit)?; - s.print_name(field.name.node)?; - s.word_space(":")?; - s.print_expr(&field.expr)?; - s.end() - }, - |f| f.span)?; + &fields[..], + |s, field| { + s.ibox(indent_unit)?; + s.print_name(field.name.node)?; + s.word_space(":")?; + s.print_expr(&field.expr)?; + s.end() + }, + |f| f.span)?; match *wth { Some(ref expr) => { self.ibox(indent_unit)?; @@ -1760,17 +1760,17 @@ pub fn print_pat(&mut self, pat: &hir::Pat) -> io::Result<()> { self.nbsp()?; self.word_space("{")?; self.commasep_cmnt(Consistent, - &fields[..], - |s, f| { - s.cbox(indent_unit)?; - if !f.node.is_shorthand { - s.print_name(f.node.name)?; - s.word_nbsp(":")?; - } - s.print_pat(&f.node.pat)?; - s.end() - }, - |f| f.node.pat.span)?; + &fields[..], + |s, f| { + s.cbox(indent_unit)?; + if !f.node.is_shorthand { + s.print_name(f.node.name)?; + s.word_nbsp(":")?; + } + s.print_pat(&f.node.pat)?; + s.end() + }, + |f| f.node.pat.span)?; if etc { if !fields.is_empty() { self.word_space(",")?; @@ -2261,13 +2261,13 @@ pub fn print_ty_fn(&mut self, }, }; self.print_fn(decl, - unsafety, - hir::Constness::NotConst, - abi, - name, - &generics, - opt_explicit_self, - hir::Inherited)?; + unsafety, + hir::Constness::NotConst, + abi, + name, + &generics, + opt_explicit_self, + hir::Inherited)?; self.end() } diff --git a/src/librustc_mir/graphviz.rs b/src/librustc_mir/graphviz.rs index 349d8e786c4182a547bcc42a6bb9704ef10594b4..953eb724f50ec33030b6a47fb0ee245f5aeb1015 100644 --- a/src/librustc_mir/graphviz.rs +++ b/src/librustc_mir/graphviz.rs @@ -65,9 +65,9 @@ pub fn write_node_label(block: BasicBlock, // Basic block number at the top. write!(w, r#"{blk}"#, - attrs=r#"bgcolor="gray" align="center""#, - colspan=num_cols, - blk=block.index())?; + attrs=r#"bgcolor="gray" align="center""#, + colspan=num_cols, + blk=block.index())?; init(w)?; @@ -145,13 +145,13 @@ fn write_graph_label(tcx: &ty::TyCtxt, nid: NodeId, mir: &Mir, w: &mut write!(w, "mut ")?; } write!(w, r#"{:?}: {}; // {}
"#, - Lvalue::Var(i as u32), escape(&var.ty), var.name)?; + Lvalue::Var(i as u32), escape(&var.ty), var.name)?; } // Compiler-introduced temporary types. for (i, temp) in mir.temp_decls.iter().enumerate() { write!(w, r#"let mut {:?}: {};
"#, - Lvalue::Temp(i as u32), escape(&temp.ty))?; + Lvalue::Temp(i as u32), escape(&temp.ty))?; } writeln!(w, ">;") diff --git a/src/librustc_trans/back/archive.rs b/src/librustc_trans/back/archive.rs index f5b480810103f466ba6f9a009e8cbe9dcdba3883..514fc52d0085b8df8b1ab2d89f86475a0b4f8aae 100644 --- a/src/librustc_trans/back/archive.rs +++ b/src/librustc_trans/back/archive.rs @@ -255,7 +255,7 @@ fn build_with_ar_cmd(&mut self) -> io::Result<()> { // permission bits. if let Some(ref s) = self.config.src { io::copy(&mut File::open(s)?, - &mut File::create(&self.config.dst)?)?; + &mut File::create(&self.config.dst)?)?; } if removals.len() > 0 { @@ -272,7 +272,7 @@ fn build_with_ar_cmd(&mut self) -> io::Result<()> { } Addition::Archive { archive, archive_name, mut skip } => { self.add_archive_members(&mut members, archive, - &archive_name, &mut *skip)?; + &archive_name, &mut *skip)?; } } } diff --git a/src/librustc_trans/trans/consts.rs b/src/librustc_trans/trans/consts.rs index 12bcd34a663360d3d591a57aab89f9fa02b09458..dd6856916f603fc72f50a143bed787c52f323300 100644 --- a/src/librustc_trans/trans/consts.rs +++ b/src/librustc_trans/trans/consts.rs @@ -976,7 +976,7 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, let method_call = ty::MethodCall::expr(e.id); let method = cx.tcx().tables.borrow().method_map[&method_call]; const_fn_call(cx, method.def_id, method.substs.clone(), - &arg_vals, param_substs, trueconst)? + &arg_vals, param_substs, trueconst)? }, hir::ExprType(ref e, _) => const_expr(cx, &e, param_substs, fn_args, trueconst)?.0, hir::ExprBlock(ref block) => { diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 0cc1fb9e1c79613da690efdee7b0ae936189d191..67bd79bb57eb304574e44e2b425415a964a03ec6 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -954,10 +954,10 @@ fn ast_type_binding_to_poly_projection_predicate<'tcx>( } let candidate = one_bound_for_assoc_type(tcx, - candidates, - &trait_ref.to_string(), - &binding.item_name.as_str(), - binding.span)?; + candidates, + &trait_ref.to_string(), + &binding.item_name.as_str(), + binding.span)?; Ok(ty::Binder(ty::ProjectionPredicate { // <-------------------------+ projection_ty: ty::ProjectionTy { // | diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs index c79a35b2f33ce9f509dd81d0df70dc20e9dde700..7dd5db831fd75f319d89aa2748f80b8d68f967c9 100644 --- a/src/librustc_typeck/check/dropck.rs +++ b/src/librustc_typeck/check/dropck.rs @@ -47,10 +47,10 @@ pub fn check_drop_impl(tcx: &TyCtxt, drop_impl_did: DefId) -> Result<(), ()> { ty::TyEnum(adt_def, self_to_impl_substs) | ty::TyStruct(adt_def, self_to_impl_substs) => { ensure_drop_params_and_item_params_correspond(tcx, - drop_impl_did, - dtor_generics, - &dtor_self_type, - adt_def.did)?; + drop_impl_did, + dtor_generics, + &dtor_self_type, + adt_def.did)?; ensure_drop_predicates_are_implied_by_item_defn(tcx, drop_impl_did, @@ -469,8 +469,7 @@ fn iterate_over_potentially_unsafe_regions_in_type<'a, 'b, 'tcx>( ty::TyTuple(ref tys) | ty::TyClosure(_, box ty::ClosureSubsts { upvar_tys: ref tys, .. }) => { for ty in tys { - iterate_over_potentially_unsafe_regions_in_type( - cx, context, ty, depth+1)? + iterate_over_potentially_unsafe_regions_in_type(cx, context, ty, depth+1)? } Ok(()) } diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 07e5ad6fb442989cda3d91c2ac9ef15133dd4bda..4e1f3d3cbb7a9cb4d3306dca8ef00b0afe36b118 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -354,17 +354,13 @@ pub fn check_crate(tcx: &TyCtxt, trait_map: ty::TraitMap) -> CompileResult { coherence::check_coherence(&ccx)); })?; - time(time_passes, "wf checking", || - check::check_wf_new(&ccx))?; + time(time_passes, "wf checking", || check::check_wf_new(&ccx))?; - time(time_passes, "item-types checking", || - check::check_item_types(&ccx))?; + time(time_passes, "item-types checking", || check::check_item_types(&ccx))?; - time(time_passes, "item-bodies checking", || - check::check_item_bodies(&ccx))?; + time(time_passes, "item-bodies checking", || check::check_item_bodies(&ccx))?; - time(time_passes, "drop-impl checking", || - check::check_drop_impls(&ccx))?; + time(time_passes, "drop-impl checking", || check::check_drop_impls(&ccx))?; check_for_entry_fn(&ccx); diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index f666a0a10176af7cd4e2c358328f4080aa0a3248..e9a883d6d7a0139a161560cb9deacfcfa4706c58 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -344,9 +344,9 @@ fn resolved_path(w: &mut fmt::Formatter, did: DefId, path: &clean::Path, root.push_str(&seg.name); root.push_str("/"); write!(w, "{}::", - root, - seg.name)?; + href='{}index.html'>{}::", + root, + seg.name)?; } } } @@ -361,7 +361,7 @@ fn resolved_path(w: &mut fmt::Formatter, did: DefId, path: &clean::Path, match href(did) { Some((url, shortty, fqp)) => { write!(w, "{}", - shortty, url, fqp.join("::"), last.name)?; + shortty, url, fqp.join("::"), last.name)?; } _ => write!(w, "{}", last.name)?, } @@ -379,8 +379,8 @@ fn primitive_link(f: &mut fmt::Formatter, let len = CURRENT_LOCATION_KEY.with(|s| s.borrow().len()); let len = if len == 0 {0} else {len - 1}; write!(f, "", - repeat("../").take(len).collect::(), - prim.to_url_str())?; + repeat("../").take(len).collect::(), + prim.to_url_str())?; needs_termination = true; } Some(&cnum) => { @@ -399,9 +399,9 @@ fn primitive_link(f: &mut fmt::Formatter, match loc { Some(root) => { write!(f, "", - root, - path.0.first().unwrap(), - prim.to_url_str())?; + root, + path.0.first().unwrap(), + prim.to_url_str())?; needs_termination = true; } None => {} @@ -490,7 +490,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { } _ => { primitive_link(f, clean::PrimitiveType::PrimitiveRawPointer, - &format!("*{}", RawMutableSpace(m)))?; + &format!("*{}", RawMutableSpace(m)))?; write!(f, "{}", t) } } @@ -508,8 +508,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { primitive_link(f, clean::Slice, &format!("&{}{}[{}]", lt, m, **bt)), _ => { - primitive_link(f, clean::Slice, - &format!("&{}{}[", lt, m))?; + primitive_link(f, clean::Slice, &format!("&{}{}[", lt, m))?; write!(f, "{}", **bt)?; primitive_link(f, clean::Slice, "]") } @@ -567,8 +566,8 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "impl{} ", self.generics)?; if let Some(ref ty) = self.trait_ { write!(f, "{}{} for ", - if self.polarity == Some(clean::ImplPolarity::Negative) { "!" } else { "" }, - *ty)?; + if self.polarity == Some(clean::ImplPolarity::Negative) { "!" } else { "" }, + *ty)?; } write!(f, "{}{}", self.for_, WhereClause(&self.generics))?; Ok(()) diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index 778d34c008012b413ed2d689d79f13d5bb185274..b3cad90ccb551ff4073f39a182c2bbeab0ce0a9b 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -71,7 +71,7 @@ fn doit(sess: &parse::ParseSess, mut lexer: lexer::StringReader, }, token::Comment => { write!(out, "{}", - Escape(&snip(next.sp)))?; + Escape(&snip(next.sp)))?; continue }, token::Shebang(s) => { @@ -180,8 +180,7 @@ fn doit(sess: &parse::ParseSess, mut lexer: lexer::StringReader, if klass == "" { write!(out, "{}", Escape(&snip))?; } else { - write!(out, "{}", klass, - Escape(&snip))?; + write!(out, "{}", klass, Escape(&snip))?; } } diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 689b8bd93950b44f827dd48f697dbaf69642c479..9e74702e06c96b8bd9348db3bedc7d90d458850e 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -630,45 +630,45 @@ fn write_shared(cx: &Context, // Add all the static files. These may already exist, but we just // overwrite them anyway to make sure that they're fresh and up-to-date. write(cx.dst.join("jquery.js"), - include_bytes!("static/jquery-2.1.4.min.js"))?; + include_bytes!("static/jquery-2.1.4.min.js"))?; write(cx.dst.join("main.js"), - include_bytes!("static/main.js"))?; + include_bytes!("static/main.js"))?; write(cx.dst.join("playpen.js"), - include_bytes!("static/playpen.js"))?; + include_bytes!("static/playpen.js"))?; write(cx.dst.join("rustdoc.css"), - include_bytes!("static/rustdoc.css"))?; + include_bytes!("static/rustdoc.css"))?; write(cx.dst.join("main.css"), - include_bytes!("static/styles/main.css"))?; + include_bytes!("static/styles/main.css"))?; write(cx.dst.join("normalize.css"), - include_bytes!("static/normalize.css"))?; + include_bytes!("static/normalize.css"))?; write(cx.dst.join("FiraSans-Regular.woff"), - include_bytes!("static/FiraSans-Regular.woff"))?; + include_bytes!("static/FiraSans-Regular.woff"))?; write(cx.dst.join("FiraSans-Medium.woff"), - include_bytes!("static/FiraSans-Medium.woff"))?; + include_bytes!("static/FiraSans-Medium.woff"))?; write(cx.dst.join("FiraSans-LICENSE.txt"), - include_bytes!("static/FiraSans-LICENSE.txt"))?; + include_bytes!("static/FiraSans-LICENSE.txt"))?; write(cx.dst.join("Heuristica-Italic.woff"), - include_bytes!("static/Heuristica-Italic.woff"))?; + include_bytes!("static/Heuristica-Italic.woff"))?; write(cx.dst.join("Heuristica-LICENSE.txt"), - include_bytes!("static/Heuristica-LICENSE.txt"))?; + include_bytes!("static/Heuristica-LICENSE.txt"))?; write(cx.dst.join("SourceSerifPro-Regular.woff"), - include_bytes!("static/SourceSerifPro-Regular.woff"))?; + include_bytes!("static/SourceSerifPro-Regular.woff"))?; write(cx.dst.join("SourceSerifPro-Bold.woff"), - include_bytes!("static/SourceSerifPro-Bold.woff"))?; + include_bytes!("static/SourceSerifPro-Bold.woff"))?; write(cx.dst.join("SourceSerifPro-LICENSE.txt"), - include_bytes!("static/SourceSerifPro-LICENSE.txt"))?; + include_bytes!("static/SourceSerifPro-LICENSE.txt"))?; write(cx.dst.join("SourceCodePro-Regular.woff"), - include_bytes!("static/SourceCodePro-Regular.woff"))?; + include_bytes!("static/SourceCodePro-Regular.woff"))?; write(cx.dst.join("SourceCodePro-Semibold.woff"), - include_bytes!("static/SourceCodePro-Semibold.woff"))?; + include_bytes!("static/SourceCodePro-Semibold.woff"))?; write(cx.dst.join("SourceCodePro-LICENSE.txt"), - include_bytes!("static/SourceCodePro-LICENSE.txt"))?; + include_bytes!("static/SourceCodePro-LICENSE.txt"))?; write(cx.dst.join("LICENSE-MIT.txt"), - include_bytes!("static/LICENSE-MIT.txt"))?; + include_bytes!("static/LICENSE-MIT.txt"))?; write(cx.dst.join("LICENSE-APACHE.txt"), - include_bytes!("static/LICENSE-APACHE.txt"))?; + include_bytes!("static/LICENSE-APACHE.txt"))?; write(cx.dst.join("COPYRIGHT.txt"), - include_bytes!("static/COPYRIGHT.txt"))?; + include_bytes!("static/COPYRIGHT.txt"))?; fn collect(path: &Path, krate: &str, key: &str) -> io::Result> { @@ -925,7 +925,7 @@ fn emit_source(&mut self, filename: &str) -> io::Result<()> { keywords: BASIC_KEYWORDS, }; layout::render(&mut w, &self.cx.layout, - &page, &(""), &Source(contents))?; + &page, &(""), &Source(contents))?; w.flush()?; self.cx.local_sources.insert(p, href); Ok(()) @@ -1290,8 +1290,8 @@ fn render(w: File, cx: &Context, it: &clean::Item, let mut writer = BufWriter::new(w); if !cx.render_redirect_pages { layout::render(&mut writer, &cx.layout, &page, - &Sidebar{ cx: cx, item: it }, - &Item{ cx: cx, item: it })?; + &Sidebar{ cx: cx, item: it }, + &Item{ cx: cx, item: it })?; } else { let mut url = repeat("../").take(cx.current.len()) .collect::(); @@ -1515,22 +1515,22 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { let amt = if self.ismodule() { cur.len() - 1 } else { cur.len() }; for (i, component) in cur.iter().enumerate().take(amt) { write!(fmt, "{}::", - repeat("../").take(cur.len() - i - 1) - .collect::(), - component)?; + repeat("../").take(cur.len() - i - 1) + .collect::(), + component)?; } } write!(fmt, "{}", - shortty(self.item), self.item.name.as_ref().unwrap())?; + shortty(self.item), self.item.name.as_ref().unwrap())?; write!(fmt, "")?; // in-band write!(fmt, "")?; write!(fmt, - r##" - - [] - - "##)?; + r##" + + [] + + "##)?; // Write `src` tag // @@ -1541,8 +1541,8 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { if self.cx.include_sources && !is_primitive { if let Some(l) = self.href() { write!(fmt, "[src]", - self.item.def_id.index.as_usize(), l, "goto source code")?; + href='{}' title='{}'>[src]", + self.item.def_id.index.as_usize(), l, "goto source code")?; } } @@ -1698,8 +1698,8 @@ fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: usize, idx2: usize) -> Ordering ItemType::AssociatedConst => ("associated-consts", "Associated Constants"), }; write!(w, "

\ - {name}

\n", - id = derive_id(short.to_owned()), name = name)?; + {name}\n
", + id = derive_id(short.to_owned()), name = name)?; } match myitem.inner { @@ -1707,13 +1707,13 @@ fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: usize, idx2: usize) -> Ordering match *src { Some(ref src) => { write!(w, "")?; @@ -1721,7 +1721,7 @@ fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: usize, idx2: usize) -> Ordering clean::ImportItem(ref import) => { write!(w, "", - VisSpace(myitem.visibility), *import)?; + VisSpace(myitem.visibility), *import)?; } _ => { @@ -1733,21 +1733,20 @@ fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: usize, idx2: usize) -> Ordering }; let doc_value = myitem.doc_value().unwrap_or(""); write!(w, " - - - - - ", - name = *myitem.name.as_ref().unwrap(), - stab_docs = stab_docs, - docs = shorter(Some(&Markdown(doc_value).to_string())), - class = shortty(myitem), - stab = myitem.stability_class(), - href = item_path(myitem), - title = full_path(cx, myitem))?; + + + + ", + name = *myitem.name.as_ref().unwrap(), + stab_docs = stab_docs, + docs = shorter(Some(&Markdown(doc_value).to_string())), + class = shortty(myitem), + stab = myitem.stability_class(), + href = item_path(myitem), + title = full_path(cx, myitem))?; } } } @@ -1824,7 +1823,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn item_constant(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, c: &clean::Constant) -> fmt::Result { write!(w, "
{vis}const \
-                    {name}: {typ}{init}
", + {name}: {typ}{init}", vis = VisSpace(it.visibility), name = it.name.as_ref().unwrap(), typ = c.type_, @@ -1835,7 +1834,7 @@ fn item_constant(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, fn item_static(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, s: &clean::Static) -> fmt::Result { write!(w, "
{vis}static {mutability}\
-                    {name}: {typ}{init}
", + {name}: {typ}{init}", vis = VisSpace(it.visibility), mutability = MutableSpace(s.mutability), name = it.name.as_ref().unwrap(), @@ -1851,7 +1850,7 @@ fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, _ => hir::Constness::NotConst }; write!(w, "
{vis}{constness}{unsafety}{abi}fn \
-                    {name}{generics}{decl}{where_clause}
", + {name}{generics}{decl}{where_clause}", vis = VisSpace(it.visibility), constness = ConstnessSpace(vis_constness), unsafety = UnsafetySpace(f.unsafety), @@ -1880,12 +1879,12 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, // Output the trait definition write!(w, "
{}{}trait {}{}{}{} ",
-                  VisSpace(it.visibility),
-                  UnsafetySpace(t.unsafety),
-                  it.name.as_ref().unwrap(),
-                  t.generics,
-                  bounds,
-                  WhereClause(&t.generics))?;
+           VisSpace(it.visibility),
+           UnsafetySpace(t.unsafety),
+           it.name.as_ref().unwrap(),
+           t.generics,
+           bounds,
+           WhereClause(&t.generics))?;
 
     let types = t.items.iter().filter(|m| m.is_associated_type()).collect::>();
     let consts = t.items.iter().filter(|m| m.is_associated_const()).collect::>();
@@ -1937,8 +1936,8 @@ fn trait_item(w: &mut fmt::Formatter, cx: &Context, m: &clean::Item, t: &clean::
         let name = m.name.as_ref().unwrap();
         let id = derive_id(format!("{}.{}", shortty(m), name));
         write!(w, "

", - id = id, - stab = m.stability_class())?; + id = id, + stab = m.stability_class())?; render_assoc_item(w, m, AssocItemLink::Anchor)?; write!(w, "")?; render_stability_since(w, m, t)?; @@ -2009,17 +2008,17 @@ fn trait_item(w: &mut fmt::Formatter, cx: &Context, m: &clean::Item, t: &clean:: } write!(w, "")?; write!(w, r#""#, - root_path = vec![".."; cx.current.len()].join("/"), - path = if it.def_id.is_local() { - cx.current.join("/") - } else { - let path = &cache.external_paths[&it.def_id]; - path[..path.len() - 1].join("/") - }, - ty = shortty(it).to_static_str(), - name = *it.name.as_ref().unwrap())?; + src="{root_path}/implementors/{path}/{ty}.{name}.js"> + "#, + root_path = vec![".."; cx.current.len()].join("/"), + path = if it.def_id.is_local() { + cx.current.join("/") + } else { + let path = &cache.external_paths[&it.def_id]; + path[..path.len() - 1].join("/") + }, + ty = shortty(it).to_static_str(), + name = *it.name.as_ref().unwrap())?; Ok(()) } @@ -2054,7 +2053,7 @@ fn render_stability_since_raw<'a>(w: &mut fmt::Formatter, if let Some(v) = ver { if containing_ver != ver && v.len() > 0 { write!(w, "{}", - v)? + v)? } } Ok(()) @@ -2131,12 +2130,12 @@ fn item_struct(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, write!(w, "
")?;
     render_attributes(w, it)?;
     render_struct(w,
-                       it,
-                       Some(&s.generics),
-                       s.struct_type,
-                       &s.fields,
-                       "",
-                       true)?;
+                  it,
+                  Some(&s.generics),
+                  s.struct_type,
+                  &s.fields,
+                  "",
+                  true)?;
     write!(w, "
")?; render_stability_since_raw(w, it.stable_since(), None)?; @@ -2153,10 +2152,10 @@ fn item_struct(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, write!(w, "

Fields

\n
{}extern crate {} as {};", - VisSpace(myitem.visibility), - src, - name)? + VisSpace(myitem.visibility), + src, + name)? } None => { write!(w, "
{}extern crate {};", - VisSpace(myitem.visibility), name)? + VisSpace(myitem.visibility), name)? } } write!(w, "
{}{}
{name} - {stab_docs} {docs} -
{name} + {stab_docs} {docs} +
")?; for field in fields { write!(w, " - ")?; } @@ -2171,10 +2170,10 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, write!(w, "
")?;
     render_attributes(w, it)?;
     write!(w, "{}enum {}{}{}",
-                  VisSpace(it.visibility),
-                  it.name.as_ref().unwrap(),
-                  e.generics,
-                  WhereClause(&e.generics))?;
+           VisSpace(it.visibility),
+           it.name.as_ref().unwrap(),
+           e.generics,
+           WhereClause(&e.generics))?;
     if e.variants.is_empty() && !e.variants_stripped {
         write!(w, " {{}}")?;
     } else {
@@ -2198,12 +2197,12 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
                         }
                         clean::StructVariant(ref s) => {
                             render_struct(w,
-                                               v,
-                                               None,
-                                               s.struct_type,
-                                               &s.fields,
-                                               "    ",
-                                               false)?;
+                                          v,
+                                          None,
+                                          s.struct_type,
+                                          &s.fields,
+                                          "    ",
+                                          false)?;
                         }
                     }
                 }
@@ -2225,7 +2224,7 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
         write!(w, "

Variants

\n
\ - {name}", - stab = field.stability_class(), - name = field.name.as_ref().unwrap())?; + \ + {name}", + stab = field.stability_class(), + name = field.name.as_ref().unwrap())?; document(w, cx, field)?; write!(w, "
")?; for variant in &e.variants { write!(w, "
{name}", - name = variant.name.as_ref().unwrap())?; + name = variant.name.as_ref().unwrap())?; document(w, cx, variant)?; use clean::{Variant, StructVariant}; @@ -2237,13 +2236,13 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, } }); write!(w, "

Fields

\n - ")?; +
")?; for field in fields { write!(w, "")?; } @@ -2281,9 +2280,9 @@ fn render_struct(w: &mut fmt::Formatter, it: &clean::Item, tab: &str, structhead: bool) -> fmt::Result { write!(w, "{}{}{}", - VisSpace(it.visibility), - if structhead {"struct "} else {""}, - it.name.as_ref().unwrap())?; + VisSpace(it.visibility), + if structhead {"struct "} else {""}, + it.name.as_ref().unwrap())?; if let Some(g) = g { write!(w, "{}{}", *g, WhereClause(g))? } @@ -2298,10 +2297,10 @@ fn render_struct(w: &mut fmt::Formatter, it: &clean::Item, } clean::StructFieldItem(clean::TypedStructField(ref ty)) => { write!(w, " {}{}: {},\n{}", - VisSpace(field.visibility), - field.name.as_ref().unwrap(), - *ty, - tab)?; + VisSpace(field.visibility), + field.name.as_ref().unwrap(), + *ty, + tab)?; } _ => unreachable!(), }; @@ -2369,13 +2368,13 @@ fn render_assoc_items(w: &mut fmt::Formatter, } AssocItemRender::DerefFor { trait_, type_ } => { write!(w, "

Methods from \ - {}<Target={}>

", trait_, type_)?; + {}<Target={}>", trait_, type_)?; false } }; for i in &non_trait { render_impl(w, cx, i, AssocItemLink::Anchor, render_header, - containing_item.stable_since())?; + containing_item.stable_since())?; } } if let AssocItemRender::DerefFor { .. } = what { @@ -2394,23 +2393,23 @@ fn render_assoc_items(w: &mut fmt::Formatter, render_deref_methods(w, cx, impl_, containing_item)?; } write!(w, "

Trait \ - Implementations

")?; + Implementations")?; let (derived, manual): (Vec<_>, Vec<&Impl>) = traits.iter().partition(|i| { i.impl_.derived }); for i in &manual { let did = i.trait_did().unwrap(); render_impl(w, cx, i, AssocItemLink::GotoSource(did), true, - containing_item.stable_since())?; + containing_item.stable_since())?; } if !derived.is_empty() { write!(w, "

\ - Derived Implementations \ -

")?; + Derived Implementations \ + ")?; for i in &derived { let did = i.trait_did().unwrap(); render_impl(w, cx, i, AssocItemLink::GotoSource(did), true, - containing_item.stable_since())?; + containing_item.stable_since())?; } } } @@ -2533,7 +2532,7 @@ fn render_default_items(w: &mut fmt::Formatter, } doctraititem(w, cx, trait_item, AssocItemLink::GotoSource(did), render_static, - outer_version)?; + outer_version)?; } Ok(()) } @@ -2554,10 +2553,10 @@ fn render_default_items(w: &mut fmt::Formatter, fn item_typedef(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, t: &clean::Typedef) -> fmt::Result { write!(w, "
type {}{}{where_clause} = {type_};
", - it.name.as_ref().unwrap(), - t.generics, - where_clause = WhereClause(&t.generics), - type_ = t.type_)?; + it.name.as_ref().unwrap(), + t.generics, + where_clause = WhereClause(&t.generics), + type_ = t.type_)?; document(w, cx, it) } @@ -2582,28 +2581,28 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { write!(fmt, "::")?; } write!(fmt, "{}", - &cx.root_path[..(cx.current.len() - i - 1) * 3], - *name)?; + &cx.root_path[..(cx.current.len() - i - 1) * 3], + *name)?; } write!(fmt, "

")?; // sidebar refers to the enclosing module, not this module let relpath = if it.is_mod() { "../" } else { "" }; write!(fmt, - "", - name = it.name.as_ref().map(|x| &x[..]).unwrap_or(""), - ty = shortty(it).to_static_str(), - path = relpath)?; + "", + name = it.name.as_ref().map(|x| &x[..]).unwrap_or(""), + ty = shortty(it).to_static_str(), + path = relpath)?; if parentlen == 0 { // there is no sidebar-items.js beyond the crate root path // FIXME maybe dynamic crate loading can be merged here } else { write!(fmt, "", - path = relpath)?; + path = relpath)?; } Ok(()) @@ -2633,8 +2632,8 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn item_macro(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, t: &clean::Macro) -> fmt::Result { w.write_str(&highlight::highlight(&t.source, - Some("macro"), - None))?; + Some("macro"), + None))?; render_stability_since_raw(w, it.stable_since(), None)?; document(w, cx, it) } diff --git a/src/librustdoc/html/toc.rs b/src/librustdoc/html/toc.rs index b9d41471d41ff00e5ca26bf5dea316305f6d1c92..305e6258baa41c31ee7f7910682c04569b782900 100644 --- a/src/librustdoc/html/toc.rs +++ b/src/librustdoc/html/toc.rs @@ -188,10 +188,10 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { // recursively format this table of contents (the // `{children}` is the key). write!(fmt, - "\n
  • {num} {name}{children}
  • ", - id = entry.id, - num = entry.sec_number, name = entry.name, - children = entry.children)? + "\n
  • {num} {name}{children}
  • ", + id = entry.id, + num = entry.sec_number, name = entry.name, + children = entry.children)? } write!(fmt, "") } diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index 07c535bf73038d9adbb11bfb5c49c090391ad044..d5d967114c407f1101ae39c2035241cabaa3969d 100644 --- a/src/libstd/sys/common/net.rs +++ b/src/libstd/sys/common/net.rs @@ -49,7 +49,7 @@ pub fn setsockopt(sock: &Socket, opt: c_int, val: c_int, unsafe { let payload = &payload as *const T as *const c_void; cvt(c::setsockopt(*sock.as_inner(), opt, val, payload, - mem::size_of::() as c::socklen_t))?; + mem::size_of::() as c::socklen_t))?; Ok(()) } } @@ -60,8 +60,8 @@ pub fn getsockopt(sock: &Socket, opt: c_int, let mut slot: T = mem::zeroed(); let mut len = mem::size_of::() as c::socklen_t; cvt(c::getsockopt(*sock.as_inner(), opt, val, - &mut slot as *mut _ as *mut _, - &mut len))?; + &mut slot as *mut _ as *mut _, + &mut len))?; assert_eq!(len as usize, mem::size_of::()); Ok(slot) } @@ -147,7 +147,7 @@ pub fn lookup_host(host: &str) -> io::Result { let mut res = ptr::null_mut(); unsafe { cvt_gai(c::getaddrinfo(c_host.as_ptr(), ptr::null(), ptr::null(), - &mut res))?; + &mut res))?; Ok(LookupHost { original: res, cur: res }) } } @@ -308,7 +308,7 @@ pub fn bind(addr: &SocketAddr) -> io::Result { // the OS to clean up the previous one. if !cfg!(windows) { setsockopt(&sock, c::SOL_SOCKET, c::SO_REUSEADDR, - 1 as c_int)?; + 1 as c_int)?; } // Bind our new socket @@ -334,7 +334,7 @@ pub fn accept(&self) -> io::Result<(TcpStream, SocketAddr)> { let mut storage: c::sockaddr_storage = unsafe { mem::zeroed() }; let mut len = mem::size_of_val(&storage) as c::socklen_t; let sock = self.inner.accept(&mut storage as *mut _ as *mut _, - &mut len)?; + &mut len)?; let addr = sockaddr_to_addr(&storage, len as usize)?; Ok((TcpStream { inner: sock, }, addr)) } diff --git a/src/libstd/sys/unix/ext/net.rs b/src/libstd/sys/unix/ext/net.rs index 51ac8cb82d130af0bf2fa066f37893fd13f75399..a74f7ea13b4157cbd15ab7d811e8dbf77e9c833d 100644 --- a/src/libstd/sys/unix/ext/net.rs +++ b/src/libstd/sys/unix/ext/net.rs @@ -642,11 +642,11 @@ fn inner(d: &UnixDatagram, buf: &[u8], path: &Path) -> io::Result { let (addr, len) = sockaddr_un(path)?; let count = cvt(libc::sendto(*d.0.as_inner(), - buf.as_ptr() as *const _, - buf.len(), - 0, - &addr as *const _ as *const _, - len))?; + buf.as_ptr() as *const _, + buf.len(), + 0, + &addr as *const _ as *const _, + len))?; Ok(count as usize) } } diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index 0d77f344914158028f7dea1489e17e51cbc9a943..eed62c9ecfd1588080ec3ba125fe906cf280cfd7 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -181,15 +181,15 @@ pub fn current_exe() -> io::Result { -1 as c_int]; let mut sz: libc::size_t = 0; cvt(libc::sysctl(mib.as_mut_ptr(), mib.len() as ::libc::c_uint, - ptr::null_mut(), &mut sz, ptr::null_mut(), - 0 as libc::size_t))?; + ptr::null_mut(), &mut sz, ptr::null_mut(), + 0 as libc::size_t))?; if sz == 0 { return Err(io::Error::last_os_error()) } let mut v: Vec = Vec::with_capacity(sz as usize); cvt(libc::sysctl(mib.as_mut_ptr(), mib.len() as ::libc::c_uint, - v.as_mut_ptr() as *mut libc::c_void, &mut sz, - ptr::null_mut(), 0 as libc::size_t))?; + v.as_mut_ptr() as *mut libc::c_void, &mut sz, + ptr::null_mut(), 0 as libc::size_t))?; if sz == 0 { return Err(io::Error::last_os_error()); } @@ -218,10 +218,10 @@ pub fn current_exe() -> io::Result { let mib = mib.as_mut_ptr(); let mut argv_len = 0; cvt(libc::sysctl(mib, 4, 0 as *mut _, &mut argv_len, - 0 as *mut _, 0))?; + 0 as *mut _, 0))?; let mut argv = Vec::<*const libc::c_char>::with_capacity(argv_len as usize); cvt(libc::sysctl(mib, 4, argv.as_mut_ptr() as *mut _, - &mut argv_len, 0 as *mut _, 0))?; + &mut argv_len, 0 as *mut _, 0))?; argv.set_len(argv_len as usize); if argv[0].is_null() { return Err(io::Error::new(io::ErrorKind::Other, diff --git a/src/libstd/sys/unix/process.rs b/src/libstd/sys/unix/process.rs index b712091dc0b576b8da1d54b6c186db5a26ec5855..6f56f3ade065a482d9c36d676491cf5df0c21b61 100644 --- a/src/libstd/sys/unix/process.rs +++ b/src/libstd/sys/unix/process.rs @@ -392,7 +392,7 @@ unsafe fn do_exec(&mut self, stdio: ChildPipes) -> io::Error { let mut set: libc::sigset_t = mem::uninitialized(); t!(cvt(libc::sigemptyset(&mut set))); t!(cvt(libc::pthread_sigmask(libc::SIG_SETMASK, &set, - ptr::null_mut()))); + ptr::null_mut()))); let ret = libc::signal(libc::SIGPIPE, libc::SIG_DFL); if ret == libc::SIG_ERR { return io::Error::last_os_error() diff --git a/src/libstd/sys/windows/fs.rs b/src/libstd/sys/windows/fs.rs index 46397e1471853568a7121ea45f61432b3bbb3b1d..529e42248f6a2c47b7fb8f8c1f608b746373785d 100644 --- a/src/libstd/sys/windows/fs.rs +++ b/src/libstd/sys/windows/fs.rs @@ -290,7 +290,7 @@ pub fn file_attr(&self) -> io::Result { unsafe { let mut info: c::BY_HANDLE_FILE_INFORMATION = mem::zeroed(); cvt(c::GetFileInformationByHandle(self.handle.raw(), - &mut info))?; + &mut info))?; let mut attr = FileAttr { attributes: info.dwFileAttributes, creation_time: info.ftCreationTime, diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index f479b36ebbdbf1d0a720a12c9e0b0e5879c93462..f4957297581bb93f3ebbf0cd6747f3ac2ab09afa 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -188,9 +188,9 @@ pub fn spawn(&mut self, default: Stdio, needs_stdin: bool) let stderr = self.stderr.as_ref().unwrap_or(&default); let stdin = stdin.to_handle(c::STD_INPUT_HANDLE, &mut pipes.stdin)?; let stdout = stdout.to_handle(c::STD_OUTPUT_HANDLE, - &mut pipes.stdout)?; + &mut pipes.stdout)?; let stderr = stderr.to_handle(c::STD_ERROR_HANDLE, - &mut pipes.stderr)?; + &mut pipes.stderr)?; si.hStdInput = stdin.raw(); si.hStdOutput = stdout.raw(); si.hStdError = stderr.raw(); diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index a12016418c68186b8f0ea13daf4cebf7790237bc..804ca6705ecbb5e9f589321de71f7c835723d0ea 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -530,51 +530,51 @@ fn encode(&self, s: &mut S) -> Result<(), S::Error> { s.emit_struct_field("start_pos", 1, |s| self.start_pos.encode(s))?; s.emit_struct_field("end_pos", 2, |s| self.end_pos.encode(s))?; s.emit_struct_field("lines", 3, |s| { - let lines = self.lines.borrow(); - // store the length - s.emit_u32(lines.len() as u32)?; - - if !lines.is_empty() { - // In order to preserve some space, we exploit the fact that - // the lines list is sorted and individual lines are - // probably not that long. Because of that we can store lines - // as a difference list, using as little space as possible - // for the differences. - let max_line_length = if lines.len() == 1 { - 0 - } else { - lines.windows(2) - .map(|w| w[1] - w[0]) - .map(|bp| bp.to_usize()) - .max() - .unwrap() - }; - - let bytes_per_diff: u8 = match max_line_length { - 0 ... 0xFF => 1, - 0x100 ... 0xFFFF => 2, - _ => 4 - }; - - // Encode the number of bytes used per diff. - bytes_per_diff.encode(s)?; - - // Encode the first element. - lines[0].encode(s)?; - - let diff_iter = (&lines[..]).windows(2) - .map(|w| (w[1] - w[0])); - - match bytes_per_diff { - 1 => for diff in diff_iter { (diff.0 as u8).encode(s)? }, - 2 => for diff in diff_iter { (diff.0 as u16).encode(s)? }, - 4 => for diff in diff_iter { diff.0.encode(s)? }, - _ => unreachable!() - } + let lines = self.lines.borrow(); + // store the length + s.emit_u32(lines.len() as u32)?; + + if !lines.is_empty() { + // In order to preserve some space, we exploit the fact that + // the lines list is sorted and individual lines are + // probably not that long. Because of that we can store lines + // as a difference list, using as little space as possible + // for the differences. + let max_line_length = if lines.len() == 1 { + 0 + } else { + lines.windows(2) + .map(|w| w[1] - w[0]) + .map(|bp| bp.to_usize()) + .max() + .unwrap() + }; + + let bytes_per_diff: u8 = match max_line_length { + 0 ... 0xFF => 1, + 0x100 ... 0xFFFF => 2, + _ => 4 + }; + + // Encode the number of bytes used per diff. + bytes_per_diff.encode(s)?; + + // Encode the first element. + lines[0].encode(s)?; + + let diff_iter = (&lines[..]).windows(2) + .map(|w| (w[1] - w[0])); + + match bytes_per_diff { + 1 => for diff in diff_iter { (diff.0 as u8).encode(s)? }, + 2 => for diff in diff_iter { (diff.0 as u16).encode(s)? }, + 4 => for diff in diff_iter { diff.0.encode(s)? }, + _ => unreachable!() } + } - Ok(()) - })?; + Ok(()) + })?; s.emit_struct_field("multibyte_chars", 4, |s| { (*self.multibyte_chars.borrow()).encode(s) }) @@ -590,33 +590,33 @@ fn decode(d: &mut D) -> Result { let start_pos: BytePos = d.read_struct_field("start_pos", 1, |d| Decodable::decode(d))?; let end_pos: BytePos = d.read_struct_field("end_pos", 2, |d| Decodable::decode(d))?; let lines: Vec = d.read_struct_field("lines", 3, |d| { - let num_lines: u32 = Decodable::decode(d)?; - let mut lines = Vec::with_capacity(num_lines as usize); + let num_lines: u32 = Decodable::decode(d)?; + let mut lines = Vec::with_capacity(num_lines as usize); + + if num_lines > 0 { + // Read the number of bytes used per diff. + let bytes_per_diff: u8 = Decodable::decode(d)?; + + // Read the first element. + let mut line_start: BytePos = Decodable::decode(d)?; + lines.push(line_start); + + for _ in 1..num_lines { + let diff = match bytes_per_diff { + 1 => d.read_u8()? as u32, + 2 => d.read_u16()? as u32, + 4 => d.read_u32()?, + _ => unreachable!() + }; - if num_lines > 0 { - // Read the number of bytes used per diff. - let bytes_per_diff: u8 = Decodable::decode(d)?; + line_start = line_start + BytePos(diff); - // Read the first element. - let mut line_start: BytePos = Decodable::decode(d)?; lines.push(line_start); - - for _ in 1..num_lines { - let diff = match bytes_per_diff { - 1 => d.read_u8()? as u32, - 2 => d.read_u16()? as u32, - 4 => d.read_u32()?, - _ => unreachable!() - }; - - line_start = line_start + BytePos(diff); - - lines.push(line_start); - } } + } - Ok(lines) - })?; + Ok(lines) + })?; let multibyte_chars: Vec = d.read_struct_field("multibyte_chars", 4, |d| Decodable::decode(d))?; Ok(FileMap { diff --git a/src/libsyntax/errors/emitter.rs b/src/libsyntax/errors/emitter.rs index c846b1866a789a0c59012b7f5e60ac8786db931c..61fdc8453d8fdf63853c7cce40855ceb077ba1cc 100644 --- a/src/libsyntax/errors/emitter.rs +++ b/src/libsyntax/errors/emitter.rs @@ -208,8 +208,8 @@ fn emit_(&mut self, if let Some(_) = self.registry.as_ref() .and_then(|registry| registry.find_description(code)) { print_diagnostic(&mut self.dst, &ss[..], Help, - &format!("run `rustc --explain {}` to see a \ - detailed explanation", code), None)?; + &format!("run `rustc --explain {}` to see a \ + detailed explanation", code), None)?; } } Ok(()) @@ -234,13 +234,13 @@ fn highlight_suggestion(&mut self, suggestion: &CodeSuggestion) -> io::Result<() let mut lines = complete.lines(); for line in lines.by_ref().take(MAX_HIGHLIGHT_LINES) { write!(&mut self.dst, "{0}:{1:2$} {3}\n", - fm.name, "", max_digits, line)?; + fm.name, "", max_digits, line)?; } // if we elided some lines, add an ellipsis if let Some(_) = lines.next() { write!(&mut self.dst, "{0:1$} {0:2$} ...\n", - "", fm.name.len(), max_digits)?; + "", fm.name.len(), max_digits)?; } Ok(()) @@ -424,15 +424,15 @@ fn highlight_lines(&mut self, // Print offending code-line remaining_err_lines -= 1; write!(&mut self.dst, "{}:{:>width$} {}\n", - fm.name, - line.line_index + 1, - cur_line_str, - width=digits)?; + fm.name, + line.line_index + 1, + cur_line_str, + width=digits)?; if s.len() > skip { // Render the spans we assembled previously (if any). println_maybe_styled!(&mut self.dst, term::Attr::ForegroundColor(lvl.color()), - "{}", s)?; + "{}", s)?; } if !overflowed_buf.is_empty() { @@ -561,13 +561,13 @@ fn end_highlight_lines(&mut self, // Print offending code-lines write!(&mut self.dst, "{}:{:>width$} {}\n", fm.name, - line.line_index + 1, line_str, width=digits)?; + line.line_index + 1, line_str, width=digits)?; remaining_err_lines -= 1; if s.len() > skip { // Render the spans we assembled previously (if any) println_maybe_styled!(&mut self.dst, term::Attr::ForegroundColor(lvl.color()), - "{}", s)?; + "{}", s)?; } prev_line_index = line.line_index; } @@ -642,7 +642,7 @@ fn print_diagnostic(dst: &mut Destination, } print_maybe_styled!(dst, term::Attr::ForegroundColor(lvl.color()), - "{}: ", lvl.to_string())?; + "{}: ", lvl.to_string())?; print_maybe_styled!(dst, term::Attr::Bold, "{}", msg)?; if let Some(code) = code { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 827f3331753e60a46762f9dd69f7972cf3fa201b..a1adc99055f081a7dda5a27c9a464918ebd1908b 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -834,7 +834,7 @@ pub fn parse_seq_to_before_gt(&mut self, F: FnMut(&mut Parser<'a>) -> PResult<'a, T>, { let (result, returned) = self.parse_seq_to_before_gt_or_return(sep, - |p| Ok(Some(f(p)?)))?; + |p| Ok(Some(f(p)?)))?; assert!(!returned); return Ok(result); } @@ -1476,8 +1476,8 @@ pub fn parse_ty(&mut self) -> PResult<'a, P> { self.bump(); let delim = self.expect_open_delim()?; let tts = self.parse_seq_to_end(&token::CloseDelim(delim), - SeqSep::none(), - |p| p.parse_token_tree())?; + SeqSep::none(), + |p| p.parse_token_tree())?; let hi = self.span.hi; TyKind::Mac(spanned(lo, hi, Mac_ { path: path, tts: tts, ctxt: EMPTY_CTXT })) } else { @@ -2225,7 +2225,7 @@ fn parse_bottom_expr(&mut self) -> PResult<'a, P> { &token::CloseDelim(token::Bracket), SeqSep::trailing_allowed(token::Comma), |p| Ok(p.parse_expr()?) - )?; + )?; let mut exprs = vec!(first_expr); exprs.extend(remaining_exprs); ex = ExprKind::Vec(exprs); @@ -2610,8 +2610,8 @@ fn parse_dot_or_call_expr_with_(&mut self, e0: P, lo: BytePos) -> PResult< let dot_pos = self.last_span.hi; e = self.parse_dot_suffix(special_idents::invalid, - mk_sp(dot_pos, dot_pos), - e, lo)?; + mk_sp(dot_pos, dot_pos), + e, lo)?; } } continue; @@ -3267,7 +3267,7 @@ fn parse_match_expr(&mut self, attrs: ThinAttributes) -> PResult<'a, P> { let match_span = self.last_span; let lo = self.last_span.lo; let discriminant = self.parse_expr_res(Restrictions::RESTRICTION_NO_STRUCT_LITERAL, - None)?; + None)?; if let Err(mut e) = self.commit_expr_expecting(&discriminant, token::OpenDelim(token::Brace)) { if self.token == token::Token::Semi { @@ -3612,8 +3612,9 @@ pub fn parse_pat(&mut self) -> PResult<'a, P> { let path = ident_to_path(ident_span, ident); self.bump(); let delim = self.expect_open_delim()?; - let tts = self.parse_seq_to_end(&token::CloseDelim(delim), - SeqSep::none(), |p| p.parse_token_tree())?; + let tts = self.parse_seq_to_end( + &token::CloseDelim(delim), + SeqSep::none(), |p| p.parse_token_tree())?; let mac = Mac_ { path: path, tts: tts, ctxt: EMPTY_CTXT }; pat = PatKind::Mac(codemap::Spanned {node: mac, span: mk_sp(lo, self.last_span.hi)}); @@ -3670,10 +3671,10 @@ pub fn parse_pat(&mut self) -> PResult<'a, P> { pat = PatKind::TupleStruct(path, None); } else { let args = self.parse_enum_variant_seq( - &token::OpenDelim(token::Paren), - &token::CloseDelim(token::Paren), - SeqSep::trailing_allowed(token::Comma), - |p| p.parse_pat())?; + &token::OpenDelim(token::Paren), + &token::CloseDelim(token::Paren), + SeqSep::trailing_allowed(token::Comma), + |p| p.parse_pat())?; pat = PatKind::TupleStruct(path, Some(args)); } } @@ -3963,7 +3964,7 @@ fn parse_stmt_without_recovery(&mut self) -> PResult<'a, Option> { // FIXME: Bad copy of attrs let restrictions = self.restrictions | Restrictions::NO_NONINLINE_MOD; match self.with_res(restrictions, - |this| this.parse_item_(attrs.clone(), false, true))? { + |this| this.parse_item_(attrs.clone(), false, true))? { Some(i) => { let hi = i.span.hi; let decl = P(spanned(lo, hi, DeclKind::Item(i))); @@ -4941,8 +4942,8 @@ fn parse_impl_method(&mut self, vis: Visibility) // eat a matched-delimiter token tree: let delim = self.expect_open_delim()?; let tts = self.parse_seq_to_end(&token::CloseDelim(delim), - SeqSep::none(), - |p| p.parse_token_tree())?; + SeqSep::none(), + |p| p.parse_token_tree())?; let m_ = Mac_ { path: pth, tts: tts, ctxt: EMPTY_CTXT }; let m: ast::Mac = codemap::Spanned { node: m_, span: mk_sp(lo, @@ -5409,8 +5410,8 @@ fn eval_src_mod(&mut self, id_sp: Span) -> PResult<'a, (ast::ItemKind, Vec )> { let ModulePathSuccess { path, owns_directory } = self.submod_path(id, - outer_attrs, - id_sp)?; + outer_attrs, + id_sp)?; self.eval_src_mod_from_path(path, owns_directory, @@ -5993,8 +5994,8 @@ fn parse_macro_use_or_failure( // eat a matched-delimiter token tree: let delim = self.expect_open_delim()?; let tts = self.parse_seq_to_end(&token::CloseDelim(delim), - SeqSep::none(), - |p| p.parse_token_tree())?; + SeqSep::none(), + |p| p.parse_token_tree())?; // single-variant-enum... : let m = Mac_ { path: pth, tts: tts, ctxt: EMPTY_CTXT }; let m: ast::Mac = codemap::Spanned { node: m, diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 9a3400025a807a1fed6cc2df4d6645ff478be267..5b06eb026d6969f968f8becbff7ef7163d67bfe4 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -388,7 +388,7 @@ pub fn fun_to_string(decl: &ast::FnDecl, to_string(|s| { s.head("")?; s.print_fn(decl, unsafety, constness, Abi::Rust, Some(name), - generics, opt_explicit_self, ast::Visibility::Inherited)?; + generics, opt_explicit_self, ast::Visibility::Inherited)?; s.end()?; // Close the head box s.end() // Close the outer box }) @@ -779,8 +779,8 @@ fn print_meta_item(&mut self, item: &ast::MetaItem) -> io::Result<()> { word(self.writer(), &name)?; self.popen()?; self.commasep(Consistent, - &items[..], - |s, i| s.print_meta_item(&i))?; + &items[..], + |s, i| s.print_meta_item(&i))?; self.pclose()?; } } @@ -915,7 +915,7 @@ pub fn commasep_cmnt(&mut self, if i < len { word(&mut self.s, ",")?; self.maybe_print_trailing_comment(get_span(elt), - Some(get_span(&elts[i]).hi))?; + Some(get_span(&elts[i]).hi))?; self.space_if_not_bol()?; } } @@ -979,7 +979,7 @@ pub fn print_type(&mut self, ty: &ast::Ty) -> io::Result<()> { ast::TyKind::Tup(ref elts) => { self.popen()?; self.commasep(Inconsistent, &elts[..], - |s, ty| s.print_type(&ty))?; + |s, ty| s.print_type(&ty))?; if elts.len() == 1 { word(&mut self.s, ",")?; } @@ -1000,11 +1000,11 @@ pub fn print_type(&mut self, ty: &ast::Ty) -> io::Result<()> { }, }; self.print_ty_fn(f.abi, - f.unsafety, - &f.decl, - None, - &generics, - None)?; + f.unsafety, + &f.decl, + None, + &generics, + None)?; } ast::TyKind::Path(None, ref path) => { self.print_path(path, false, 0)?; @@ -1050,16 +1050,15 @@ pub fn print_foreign_item(&mut self, ast::ForeignItemKind::Fn(ref decl, ref generics) => { self.head("")?; self.print_fn(decl, ast::Unsafety::Normal, - ast::Constness::NotConst, - Abi::Rust, Some(item.ident), - generics, None, item.vis)?; + ast::Constness::NotConst, + Abi::Rust, Some(item.ident), + generics, None, item.vis)?; self.end()?; // end head-ibox word(&mut self.s, ";")?; self.end() // end the outer fn box } ast::ForeignItemKind::Static(ref t, m) => { - self.head(&visibility_qualified(item.vis, - "static"))?; + self.head(&visibility_qualified(item.vis, "static"))?; if m { self.word_space("mut")?; } @@ -1119,8 +1118,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> { self.ann.pre(self, NodeItem(item))?; match item.node { ast::ItemKind::ExternCrate(ref optional_path) => { - self.head(&visibility_qualified(item.vis, - "extern crate"))?; + self.head(&visibility_qualified(item.vis, "extern crate"))?; if let Some(p) = *optional_path { let val = p.as_str(); if val.contains("-") { @@ -1138,16 +1136,14 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> { self.end()?; // end outer head-block } ast::ItemKind::Use(ref vp) => { - self.head(&visibility_qualified(item.vis, - "use"))?; + self.head(&visibility_qualified(item.vis, "use"))?; self.print_view_path(&vp)?; word(&mut self.s, ";")?; self.end()?; // end inner head-block self.end()?; // end outer head-block } ast::ItemKind::Static(ref ty, m, ref expr) => { - self.head(&visibility_qualified(item.vis, - "static"))?; + self.head(&visibility_qualified(item.vis, "static"))?; if m == ast::Mutability::Mutable { self.word_space("mut")?; } @@ -1163,8 +1159,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> { self.end()?; // end the outer cbox } ast::ItemKind::Const(ref ty, ref expr) => { - self.head(&visibility_qualified(item.vis, - "const"))?; + self.head(&visibility_qualified(item.vis, "const"))?; self.print_ident(item.ident)?; self.word_space(":")?; self.print_type(&ty)?; @@ -1192,8 +1187,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> { self.print_block_with_attrs(&body, &item.attrs)?; } ast::ItemKind::Mod(ref _mod) => { - self.head(&visibility_qualified(item.vis, - "mod"))?; + self.head(&visibility_qualified(item.vis, "mod"))?; self.print_ident(item.ident)?; self.nbsp()?; self.bopen()?; @@ -1555,8 +1549,8 @@ pub fn print_trait_item(&mut self, ti: &ast::TraitItem) match ti.node { ast::TraitItemKind::Const(ref ty, ref default) => { self.print_associated_const(ti.ident, &ty, - default.as_ref().map(|expr| &**expr), - ast::Visibility::Inherited)?; + default.as_ref().map(|expr| &**expr), + ast::Visibility::Inherited)?; } ast::TraitItemKind::Method(ref sig, ref body) => { if body.is_some() { @@ -1572,7 +1566,7 @@ pub fn print_trait_item(&mut self, ti: &ast::TraitItem) } ast::TraitItemKind::Type(ref bounds, ref default) => { self.print_associated_type(ti.ident, Some(bounds), - default.as_ref().map(|ty| &**ty))?; + default.as_ref().map(|ty| &**ty))?; } } self.ann.post(self, NodeSubItem(ti.id)) @@ -1923,7 +1917,7 @@ fn print_expr_method_call(&mut self, if !tys.is_empty() { word(&mut self.s, "::<")?; self.commasep(Inconsistent, tys, - |s, ty| s.print_type(&ty))?; + |s, ty| s.print_type(&ty))?; word(&mut self.s, ">")?; } self.print_call_post(base_args) @@ -2223,7 +2217,7 @@ fn print_expr_outer_attr_style(&mut self, match out.constraint.slice_shift_char() { Some(('=', operand)) if out.is_rw => { s.print_string(&format!("+{}", operand), - ast::StrStyle::Cooked)? + ast::StrStyle::Cooked)? } _ => s.print_string(&out.constraint, ast::StrStyle::Cooked)? } @@ -2267,10 +2261,10 @@ fn print_expr_outer_attr_style(&mut self, space(&mut self.s)?; self.word_space(":")?; self.commasep(Inconsistent, &options, - |s, &co| { - s.print_string(co, ast::StrStyle::Cooked)?; - Ok(()) - })?; + |s, &co| { + s.print_string(co, ast::StrStyle::Cooked)?; + Ok(()) + })?; } self.pclose()?; @@ -3037,13 +3031,13 @@ pub fn print_ty_fn(&mut self, }, }; self.print_fn(decl, - unsafety, - ast::Constness::NotConst, - abi, - name, - &generics, - opt_explicit_self, - ast::Visibility::Inherited)?; + unsafety, + ast::Constness::NotConst, + abi, + name, + &generics, + opt_explicit_self, + ast::Visibility::Inherited)?; self.end() } diff --git a/src/tools/error_index_generator/main.rs b/src/tools/error_index_generator/main.rs index fd7441d85ce2783e35cfd91e64b6d139d55686e6..2c734c8e3e4d4cbeac69ea5b266695df6d8eea95 100644 --- a/src/tools/error_index_generator/main.rs +++ b/src/tools/error_index_generator/main.rs @@ -96,8 +96,8 @@ fn error_code_block(&self, output: &mut Write, info: &ErrorMetadata, // Error title (with self-link). write!(output, - "

    {0}

    \n", - err_code)?; + "

    {0}

    \n", + err_code)?; // Description rendered as markdown. match info.description { diff --git a/src/tools/rustbook/build.rs b/src/tools/rustbook/build.rs index f9dc8ffa4c4484e36e3eb6f77af368f29c2fc49c..6014439fafcf9661cfe981a515bea5558f8c58a4 100644 --- a/src/tools/rustbook/build.rs +++ b/src/tools/rustbook/build.rs @@ -56,10 +56,10 @@ fn walk_item(item: &BookItem, }; writeln!(out, "
  • {} {}", - class_string, - current_page.path_to_root.join(&item.path).with_extension("html").display(), - section, - item.title)?; + class_string, + current_page.path_to_root.join(&item.path).with_extension("html").display(), + section, + item.title)?; if !item.children.is_empty() { writeln!(out, "
      ")?; let _ = walk_items(&item.children[..], section, current_page, out);
  • \ - {f}", - v = variant.name.as_ref().unwrap(), - f = field.name.as_ref().unwrap())?; + id='variant.{v}.field.{f}'>\ + {f}", + v = variant.name.as_ref().unwrap(), + f = field.name.as_ref().unwrap())?; document(w, cx, field)?; write!(w, "