Skip to content

Commit b9b1013

Browse files
committed
Fix tidy and formatting
1 parent dcc5c7c commit b9b1013

File tree

122 files changed

+1085
-1058
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+1085
-1058
lines changed

src/librustc_back/dynamic_lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ mod dl {
186186
}
187187

188188
pub(crate) unsafe fn symbol(handle: *mut u8,
189-
symbol: *const libc::c_char)
190-
-> Result<*mut u8, String> {
189+
symbol: *const libc::c_char)
190+
-> Result<*mut u8, String> {
191191
check_for_errors_in(|| {
192192
libc::dlsym(handle as *mut libc::c_void, symbol) as *mut u8
193193
})

src/librustc_borrowck/borrowck/check_loans.rs

+19-19
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> {
185185
}
186186

187187
pub(crate) fn check_loans<'a, 'b, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
188-
dfcx_loans: &LoanDataFlow<'b, 'tcx>,
189-
move_data: &move_data::FlowedMoveData<'c, 'tcx>,
190-
all_loans: &[Loan<'tcx>],
191-
body: &hir::Body) {
188+
dfcx_loans: &LoanDataFlow<'b, 'tcx>,
189+
move_data: &move_data::FlowedMoveData<'c, 'tcx>,
190+
all_loans: &[Loan<'tcx>],
191+
body: &hir::Body) {
192192
debug!("check_loans(body id={})", body.value.id);
193193

194194
let def_id = bccx.tcx.hir.body_owner_def_id(body.id());
@@ -369,9 +369,9 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
369369
}
370370

371371
pub(crate) fn report_error_if_loans_conflict(&self,
372-
old_loan: &Loan<'tcx>,
373-
new_loan: &Loan<'tcx>)
374-
-> bool {
372+
old_loan: &Loan<'tcx>,
373+
new_loan: &Loan<'tcx>)
374+
-> bool {
375375
//! Checks whether `old_loan` and `new_loan` can safely be issued
376376
//! simultaneously.
377377
@@ -390,11 +390,11 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
390390
}
391391

392392
pub(crate) fn report_error_if_loan_conflicts_with_restriction(&self,
393-
loan1: &Loan<'tcx>,
394-
loan2: &Loan<'tcx>,
395-
old_loan: &Loan<'tcx>,
396-
new_loan: &Loan<'tcx>)
397-
-> bool {
393+
loan1: &Loan<'tcx>,
394+
loan2: &Loan<'tcx>,
395+
old_loan: &Loan<'tcx>,
396+
new_loan: &Loan<'tcx>)
397+
-> bool {
398398
//! Checks whether the restrictions introduced by `loan1` would
399399
//! prohibit `loan2`. Returns false if an error is reported.
400400
@@ -699,10 +699,10 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
699699
}
700700

701701
pub(crate) fn analyze_restrictions_on_use(&self,
702-
expr_id: ast::NodeId,
703-
use_path: &LoanPath<'tcx>,
704-
borrow_kind: ty::BorrowKind)
705-
-> UseError<'tcx> {
702+
expr_id: ast::NodeId,
703+
use_path: &LoanPath<'tcx>,
704+
borrow_kind: ty::BorrowKind)
705+
-> UseError<'tcx> {
706706
debug!("analyze_restrictions_on_use(expr_id={}, use_path={:?})",
707707
self.tcx().hir.node_to_string(expr_id),
708708
use_path);
@@ -857,9 +857,9 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
857857
}
858858

859859
pub(crate) fn report_illegal_mutation(&self,
860-
span: Span,
861-
loan_path: &LoanPath<'tcx>,
862-
loan: &Loan) {
860+
span: Span,
861+
loan_path: &LoanPath<'tcx>,
862+
loan: &Loan) {
863863
struct_span_err!(self.bccx, span, E0506,
864864
"cannot assign to `{}` because it is borrowed",
865865
self.bccx.loan_path_to_string(loan_path))

src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs

+18-18
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,19 @@ fn get_pattern_source<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, pat: &Pat) -> Patte
8787
}
8888

8989
pub(crate) fn gather_decl<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
90-
move_data: &MoveData<'tcx>,
91-
var_id: ast::NodeId,
92-
var_ty: Ty<'tcx>) {
90+
move_data: &MoveData<'tcx>,
91+
var_id: ast::NodeId,
92+
var_ty: Ty<'tcx>) {
9393
let loan_path = Rc::new(LoanPath::new(LpVar(var_id), var_ty));
9494
move_data.add_move(bccx.tcx, loan_path, var_id, Declared);
9595
}
9696

9797
pub(crate) fn gather_move_from_expr<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
98-
move_data: &MoveData<'tcx>,
99-
move_error_collector: &mut MoveErrorCollector<'tcx>,
100-
move_expr_id: ast::NodeId,
101-
cmt: mc::cmt<'tcx>,
102-
move_reason: euv::MoveReason) {
98+
move_data: &MoveData<'tcx>,
99+
move_error_collector: &mut MoveErrorCollector<'tcx>,
100+
move_expr_id: ast::NodeId,
101+
cmt: mc::cmt<'tcx>,
102+
move_reason: euv::MoveReason) {
103103
let kind = match move_reason {
104104
euv::DirectRefMove | euv::PatBindingMove => MoveExpr,
105105
euv::CaptureMove => Captured
@@ -114,10 +114,10 @@ pub(crate) fn gather_move_from_expr<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
114114
}
115115

116116
pub(crate) fn gather_move_from_pat<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
117-
move_data: &MoveData<'tcx>,
118-
move_error_collector: &mut MoveErrorCollector<'tcx>,
119-
move_pat: &hir::Pat,
120-
cmt: mc::cmt<'tcx>) {
117+
move_data: &MoveData<'tcx>,
118+
move_error_collector: &mut MoveErrorCollector<'tcx>,
119+
move_pat: &hir::Pat,
120+
cmt: mc::cmt<'tcx>) {
121121
let source = get_pattern_source(bccx.tcx,move_pat);
122122
let pat_span_path_opt = match move_pat.node {
123123
PatKind::Binding(_, _, ref path1, _) => {
@@ -172,12 +172,12 @@ fn gather_move<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
172172
}
173173

174174
pub(crate) fn gather_assignment<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
175-
move_data: &MoveData<'tcx>,
176-
assignment_id: ast::NodeId,
177-
assignment_span: Span,
178-
assignee_loan_path: Rc<LoanPath<'tcx>>,
179-
assignee_id: ast::NodeId,
180-
mode: euv::MutateMode) {
175+
move_data: &MoveData<'tcx>,
176+
assignment_id: ast::NodeId,
177+
assignment_span: Span,
178+
assignee_loan_path: Rc<LoanPath<'tcx>>,
179+
assignee_id: ast::NodeId,
180+
mode: euv::MutateMode) {
181181
move_data.add_assignment(bccx.tcx,
182182
assignee_loan_path,
183183
assignment_id,

src/librustc_borrowck/borrowck/gather_loans/lifetime.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ use syntax_pos::Span;
2424
type R = Result<(),()>;
2525

2626
pub(crate) fn guarantee_lifetime<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
27-
item_scope: region::CodeExtent,
28-
span: Span,
29-
cause: euv::LoanCause,
30-
cmt: mc::cmt<'tcx>,
31-
loan_region: ty::Region<'tcx>,
32-
_: ty::BorrowKind)
33-
-> Result<(),()> {
27+
item_scope: region::CodeExtent,
28+
span: Span,
29+
cause: euv::LoanCause,
30+
cmt: mc::cmt<'tcx>,
31+
loan_region: ty::Region<'tcx>,
32+
_: ty::BorrowKind)
33+
-> Result<(),()> {
3434
//! Reports error if `loan_region` is larger than S
3535
//! where S is `item_scope` if `cmt` is an upvar,
3636
//! and is scope of `cmt` otherwise.

src/librustc_borrowck/borrowck/gather_loans/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ mod gather_moves;
3636
mod move_error;
3737

3838
pub(crate) fn gather_loans_in_fn<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
39-
body: hir::BodyId)
40-
-> (Vec<Loan<'tcx>>, move_data::MoveData<'tcx>) {
39+
body: hir::BodyId)
40+
-> (Vec<Loan<'tcx>>, move_data::MoveData<'tcx>) {
4141
let def_id = bccx.tcx.hir.body_owner_def_id(body);
4242
let param_env = bccx.tcx.param_env(def_id);
4343
let mut glcx = GatherLoanCtxt {
@@ -447,9 +447,9 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
447447
}
448448

449449
pub(crate) fn compute_gen_scope(&self,
450-
borrow_scope: region::CodeExtent,
451-
loan_scope: region::CodeExtent)
452-
-> region::CodeExtent {
450+
borrow_scope: region::CodeExtent,
451+
loan_scope: region::CodeExtent)
452+
-> region::CodeExtent {
453453
//! Determine when to introduce the loan. Typically the loan
454454
//! is introduced at the point of the borrow, but in some cases,
455455
//! notably method arguments, the loan may be introduced only
@@ -463,7 +463,7 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
463463
}
464464

465465
pub(crate) fn compute_kill_scope(&self, loan_scope: region::CodeExtent, lp: &LoanPath<'tcx>)
466-
-> region::CodeExtent {
466+
-> region::CodeExtent {
467467
//! Determine when the loan restrictions go out of scope.
468468
//! This is either when the lifetime expires or when the
469469
//! local variable which roots the loan-path goes out of scope,

src/librustc_borrowck/borrowck/gather_loans/move_error.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ pub(crate) struct MoveError<'tcx> {
4646

4747
impl<'tcx> MoveError<'tcx> {
4848
pub(crate) fn with_move_info(move_from: mc::cmt<'tcx>,
49-
move_to: Option<MovePlace<'tcx>>)
50-
-> MoveError<'tcx> {
49+
move_to: Option<MovePlace<'tcx>>)
50+
-> MoveError<'tcx> {
5151
MoveError {
5252
move_from: move_from,
5353
move_to: move_to,

src/librustc_borrowck/borrowck/gather_loans/restrictions.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ pub(crate) enum RestrictionResult<'tcx> {
2828
}
2929

3030
pub(crate) fn compute_restrictions<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
31-
span: Span,
32-
cause: euv::LoanCause,
33-
cmt: mc::cmt<'tcx>,
34-
loan_region: ty::Region<'tcx>)
35-
-> RestrictionResult<'tcx> {
31+
span: Span,
32+
cause: euv::LoanCause,
33+
cmt: mc::cmt<'tcx>,
34+
loan_region: ty::Region<'tcx>)
35+
-> RestrictionResult<'tcx> {
3636
let ctxt = RestrictionsContext {
3737
bccx: bccx,
3838
span: span,

src/librustc_borrowck/borrowck/mod.rs

+26-27
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,7 @@ pub(crate) enum LoanPathElem<'tcx> {
302302
LpInterior(Option<DefId>, InteriorKind),
303303
}
304304

305-
pub(crate) fn closure_to_block(closure_id: ast::NodeId,
306-
tcx: TyCtxt) -> ast::NodeId {
305+
pub(crate) fn closure_to_block(closure_id: ast::NodeId, tcx: TyCtxt) -> ast::NodeId {
307306
match tcx.hir.get(closure_id) {
308307
hir_map::NodeExpr(expr) => match expr.node {
309308
hir::ExprClosure(.., body_id, _) => {
@@ -481,9 +480,9 @@ pub(crate) enum MovedValueUseKind {
481480

482481
impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
483482
pub(crate) fn is_subregion_of(&self,
484-
r_sub: ty::Region<'tcx>,
485-
r_sup: ty::Region<'tcx>)
486-
-> bool
483+
r_sub: ty::Region<'tcx>,
484+
r_sup: ty::Region<'tcx>)
485+
-> bool
487486
{
488487
let region_rels = RegionRelations::new(self.tcx,
489488
self.owner_def_id,
@@ -512,12 +511,12 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
512511
}
513512

514513
pub(crate) fn report_use_of_moved_value(&self,
515-
use_span: Span,
516-
use_kind: MovedValueUseKind,
517-
lp: &LoanPath<'tcx>,
518-
the_move: &move_data::Move,
519-
moved_lp: &LoanPath<'tcx>,
520-
_param_env: ty::ParamEnv<'tcx>) {
514+
use_span: Span,
515+
use_kind: MovedValueUseKind,
516+
lp: &LoanPath<'tcx>,
517+
the_move: &move_data::Move,
518+
moved_lp: &LoanPath<'tcx>,
519+
_param_env: ty::ParamEnv<'tcx>) {
521520
let (verb, verb_participle) = match use_kind {
522521
MovedInUse => ("use", "used"),
523522
MovedInCapture => ("capture", "captured"),
@@ -656,10 +655,10 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
656655
}
657656

658657
pub(crate) fn report_reassigned_immutable_variable(&self,
659-
span: Span,
660-
lp: &LoanPath<'tcx>,
661-
assign:
662-
&move_data::Assignment) {
658+
span: Span,
659+
lp: &LoanPath<'tcx>,
660+
assign:
661+
&move_data::Assignment) {
663662
let mut err = struct_span_err!(
664663
self.tcx.sess, span, E0384,
665664
"re-assignment of immutable variable `{}`",
@@ -673,10 +672,10 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
673672
}
674673

675674
pub(crate) fn struct_span_err_with_code<S: Into<MultiSpan>>(&self,
676-
s: S,
677-
msg: &str,
678-
code: &str)
679-
-> DiagnosticBuilder<'a> {
675+
s: S,
676+
msg: &str,
677+
code: &str)
678+
-> DiagnosticBuilder<'a> {
680679
self.tcx.sess.struct_span_err_with_code(s, msg, code)
681680
}
682681

@@ -749,10 +748,10 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
749748
}
750749

751750
pub(crate) fn report_aliasability_violation(&self,
752-
span: Span,
753-
kind: AliasableViolationKind,
754-
cause: mc::AliasableReason,
755-
cmt: mc::cmt<'tcx>) {
751+
span: Span,
752+
kind: AliasableViolationKind,
753+
cause: mc::AliasableReason,
754+
cmt: mc::cmt<'tcx>) {
756755
let mut is_closure = false;
757756
let prefix = match kind {
758757
MutabilityViolation => {
@@ -1169,8 +1168,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
11691168
}
11701169
}
11711170
pub(crate) fn append_loan_path_to_string(&self,
1172-
loan_path: &LoanPath<'tcx>,
1173-
out: &mut String) {
1171+
loan_path: &LoanPath<'tcx>,
1172+
out: &mut String) {
11741173
match loan_path.kind {
11751174
LpUpvar(ty::UpvarId{ var_id: id, closure_expr_id: _ }) |
11761175
LpVar(id) => {
@@ -1212,8 +1211,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
12121211
}
12131212

12141213
pub(crate) fn append_autoderefd_loan_path_to_string(&self,
1215-
loan_path: &LoanPath<'tcx>,
1216-
out: &mut String) {
1214+
loan_path: &LoanPath<'tcx>,
1215+
out: &mut String) {
12171216
match loan_path.kind {
12181217
LpExtend(ref lp_base, _, LpDeref(_)) => {
12191218
// For a path like `(*x).f` or `(*x)[3]`, autoderef

0 commit comments

Comments
 (0)