Skip to content

Commit 889b0e9

Browse files
author
corentih
committed
rustfmt librustc_resolve
1 parent 4f5edf9 commit 889b0e9

File tree

6 files changed

+1220
-1190
lines changed

6 files changed

+1220
-1190
lines changed

src/librustc_resolve/build_reduced_graph.rs

+267-256
Large diffs are not rendered by default.

src/librustc_resolve/check_unused.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ use rustc_front::hir;
3131
use rustc_front::hir::{ViewPathGlob, ViewPathList, ViewPathSimple};
3232
use rustc_front::visit::{self, Visitor};
3333

34-
struct UnusedImportCheckVisitor<'a, 'b:'a, 'tcx:'b> {
35-
resolver: &'a mut Resolver<'b, 'tcx>
34+
struct UnusedImportCheckVisitor<'a, 'b: 'a, 'tcx: 'b> {
35+
resolver: &'a mut Resolver<'b, 'tcx>,
3636
}
3737

3838
// Deref and DerefMut impls allow treating UnusedImportCheckVisitor as Resolver.
@@ -51,16 +51,16 @@ impl<'a, 'b, 'tcx:'b> DerefMut for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
5151
}
5252

5353
impl<'a, 'b, 'tcx> UnusedImportCheckVisitor<'a, 'b, 'tcx> {
54-
// We have information about whether `use` (import) directives are actually used now.
55-
// If an import is not used at all, we signal a lint error. If an import is only used
56-
// for a single namespace, we remove the other namespace from the recorded privacy
57-
// information. That means in privacy.rs, we will only check imports and namespaces
58-
// which are used. In particular, this means that if an import could name either a
59-
// public or private item, we will check the correct thing, dependent on how the import
60-
// is used.
54+
// We have information about whether `use` (import) directives are actually
55+
// used now. If an import is not used at all, we signal a lint error. If an
56+
// import is only used for a single namespace, we remove the other namespace
57+
// from the recorded privacy information. That means in privacy.rs, we will
58+
// only check imports and namespaces which are used. In particular, this
59+
// means that if an import could name either a public or private item, we
60+
// will check the correct thing, dependent on how the import is used.
6161
fn finalize_import(&mut self, id: ast::NodeId, span: Span) {
6262
debug!("finalizing import uses for {:?}",
63-
self.session.codemap().span_to_snippet(span));
63+
self.session.codemap().span_to_snippet(span));
6464

6565
if !self.used_imports.contains(&(id, TypeNS)) &&
6666
!self.used_imports.contains(&(id, ValueNS)) {
@@ -99,14 +99,14 @@ impl<'a, 'b, 'tcx> UnusedImportCheckVisitor<'a, 'b, 'tcx> {
9999
// we might have two LastPrivates pointing at the same thing. There is no point
100100
// checking both, so lets not check the value one.
101101
(Some(DependsOn(def_v)), Some(DependsOn(def_t))) if def_v == def_t => v_used = Unused,
102-
_ => {},
102+
_ => {}
103103
}
104104

105105
path_res.last_private = LastImport {
106106
value_priv: v_priv,
107107
value_used: v_used,
108108
type_priv: t_priv,
109-
type_used: t_used
109+
type_used: t_used,
110110
};
111111
}
112112
}
@@ -132,7 +132,7 @@ impl<'a, 'b, 'v, 'tcx> Visitor<'v> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
132132
"unused extern crate".to_string());
133133
}
134134
}
135-
},
135+
}
136136
hir::ItemUse(ref p) => {
137137
match p.node {
138138
ViewPathSimple(_, _) => {

src/librustc_resolve/diagnostics.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
#![allow(non_snake_case)]
1212

13-
// Error messages for EXXXX errors.
14-
// Each message should start and end with a new line, and be wrapped to 80 characters.
15-
// In vim you can `:set tw=80` and use `gq` to wrap paragraphs. Use `:set tw=0` to disable.
13+
// Error messages for EXXXX errors. Each message should start and end with a
14+
// new line, and be wrapped to 80 characters. In vim you can `:set tw=80` and
15+
// use `gq` to wrap paragraphs. Use `:set tw=0` to disable.
1616
register_long_diagnostics! {
1717

1818
E0154: r##"

0 commit comments

Comments
 (0)