Changed most vec! invocations to use square braces
Most of the Rust community agrees that the vec! macro is clearer when called using square brackets [] instead of regular brackets (). Most of these ocurrences are from before macros allowed using different types of brackets. There is one left unchanged in a pretty-print test, as the pretty printer still wants it to have regular brackets.
This commit is contained in:
parent
f26eedb571
commit
e593c3b893
189 changed files with 511 additions and 511 deletions
|
|
@ -536,7 +536,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
|
|||
fn add_contained_edge(&mut self,
|
||||
source: CFGIndex,
|
||||
target: CFGIndex) {
|
||||
let data = CFGEdgeData {exiting_scopes: vec!() };
|
||||
let data = CFGEdgeData {exiting_scopes: vec![] };
|
||||
self.graph.add_edge(source, target, data);
|
||||
}
|
||||
|
||||
|
|
@ -545,7 +545,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
|
|||
from_index: CFGIndex,
|
||||
to_loop: LoopScope,
|
||||
to_index: CFGIndex) {
|
||||
let mut data = CFGEdgeData {exiting_scopes: vec!() };
|
||||
let mut data = CFGEdgeData {exiting_scopes: vec![] };
|
||||
let mut scope = self.tcx.region_maps.node_extent(from_expr.id);
|
||||
let target_scope = self.tcx.region_maps.node_extent(to_loop.loop_id);
|
||||
while scope != target_scope {
|
||||
|
|
@ -559,7 +559,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
|
|||
_from_expr: &hir::Expr,
|
||||
from_index: CFGIndex) {
|
||||
let mut data = CFGEdgeData {
|
||||
exiting_scopes: vec!(),
|
||||
exiting_scopes: vec![],
|
||||
};
|
||||
for &LoopScope { loop_id: id, .. } in self.loop_scopes.iter().rev() {
|
||||
data.exiting_scopes.push(id);
|
||||
|
|
|
|||
|
|
@ -457,7 +457,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
same_regions.push(SameRegions {
|
||||
scope_id: scope_id,
|
||||
regions: vec!(sub_fr.bound_region, sup_fr.bound_region)
|
||||
regions: vec![sub_fr.bound_region, sup_fr.bound_region]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -1359,7 +1359,7 @@ impl<'a, 'gcx, 'tcx> Rebuilder<'a, 'gcx, 'tcx> {
|
|||
region_names: &HashSet<ast::Name>)
|
||||
-> P<hir::Ty> {
|
||||
let mut new_ty = P(ty.clone());
|
||||
let mut ty_queue = vec!(ty);
|
||||
let mut ty_queue = vec![ty];
|
||||
while !ty_queue.is_empty() {
|
||||
let cur_ty = ty_queue.remove(0);
|
||||
match cur_ty.node {
|
||||
|
|
|
|||
|
|
@ -127,9 +127,9 @@ impl LintStore {
|
|||
|
||||
pub fn new() -> LintStore {
|
||||
LintStore {
|
||||
lints: vec!(),
|
||||
early_passes: Some(vec!()),
|
||||
late_passes: Some(vec!()),
|
||||
lints: vec![],
|
||||
early_passes: Some(vec![]),
|
||||
late_passes: Some(vec![]),
|
||||
by_name: FnvHashMap(),
|
||||
levels: FnvHashMap(),
|
||||
future_incompatible: FnvHashMap(),
|
||||
|
|
@ -345,7 +345,7 @@ macro_rules! run_lints { ($cx:expr, $f:ident, $ps:ident, $($args:expr),*) => ({
|
|||
// See also the hir version just below.
|
||||
pub fn gather_attrs(attrs: &[ast::Attribute])
|
||||
-> Vec<Result<(InternedString, Level, Span), Span>> {
|
||||
let mut out = vec!();
|
||||
let mut out = vec![];
|
||||
for attr in attrs {
|
||||
let r = gather_attr(attr);
|
||||
out.extend(r.into_iter());
|
||||
|
|
@ -355,7 +355,7 @@ pub fn gather_attrs(attrs: &[ast::Attribute])
|
|||
|
||||
pub fn gather_attr(attr: &ast::Attribute)
|
||||
-> Vec<Result<(InternedString, Level, Span), Span>> {
|
||||
let mut out = vec!();
|
||||
let mut out = vec![];
|
||||
|
||||
let level = match Level::from_str(&attr.name()) {
|
||||
None => return out,
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ impl LanguageItems {
|
|||
fn foo(_: LangItem) -> Option<DefId> { None }
|
||||
|
||||
LanguageItems {
|
||||
items: vec!($(foo($variant)),*),
|
||||
items: vec![$(foo($variant)),*],
|
||||
missing: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -715,7 +715,7 @@ macro_rules! options {
|
|||
true
|
||||
}
|
||||
v => {
|
||||
let mut passes = vec!();
|
||||
let mut passes = vec![];
|
||||
if parse_list(&mut passes, v) {
|
||||
*slot = SomePasses(passes);
|
||||
true
|
||||
|
|
@ -1293,7 +1293,7 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
|
|||
let crate_types = parse_crate_types_from_list(unparsed_crate_types)
|
||||
.unwrap_or_else(|e| early_error(error_format, &e[..]));
|
||||
|
||||
let mut lint_opts = vec!();
|
||||
let mut lint_opts = vec![];
|
||||
let mut describe_lints = false;
|
||||
|
||||
for &level in &[lint::Allow, lint::Warn, lint::Deny, lint::Forbid] {
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ impl Session {
|
|||
}
|
||||
return;
|
||||
}
|
||||
lints.insert(id, vec!((lint_id, sp, msg)));
|
||||
lints.insert(id, vec![(lint_id, sp, msg)]);
|
||||
}
|
||||
pub fn reserve_node_ids(&self, count: usize) -> ast::NodeId {
|
||||
let id = self.next_node_id.get();
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ impl<'a, 'b, 'gcx, 'tcx> AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx> {
|
|||
AssociatedTypeNormalizer {
|
||||
selcx: selcx,
|
||||
cause: cause,
|
||||
obligations: vec!(),
|
||||
obligations: vec![],
|
||||
depth: depth,
|
||||
}
|
||||
}
|
||||
|
|
@ -396,7 +396,7 @@ pub fn normalize_projection_type<'a, 'b, 'gcx, 'tcx>(
|
|||
cause, depth + 1, projection.to_predicate());
|
||||
Normalized {
|
||||
value: ty_var,
|
||||
obligations: vec!(obligation)
|
||||
obligations: vec![obligation]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -545,7 +545,7 @@ fn opt_normalize_projection_type<'a, 'b, 'gcx, 'tcx>(
|
|||
projected_ty);
|
||||
let result = Normalized {
|
||||
value: projected_ty,
|
||||
obligations: vec!()
|
||||
obligations: vec![]
|
||||
};
|
||||
infcx.projection_cache.borrow_mut()
|
||||
.complete(projection_ty, &result, true);
|
||||
|
|
@ -604,7 +604,7 @@ fn normalize_to_error<'a, 'gcx, 'tcx>(selcx: &mut SelectionContext<'a, 'gcx, 'tc
|
|||
let new_value = selcx.infcx().next_ty_var();
|
||||
Normalized {
|
||||
value: new_value,
|
||||
obligations: vec!(trait_obligation)
|
||||
obligations: vec![trait_obligation]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ pub struct TypeWalker<'tcx> {
|
|||
|
||||
impl<'tcx> TypeWalker<'tcx> {
|
||||
pub fn new(ty: Ty<'tcx>) -> TypeWalker<'tcx> {
|
||||
TypeWalker { stack: vec!(ty), last_subtree: 1, }
|
||||
TypeWalker { stack: vec![ty], last_subtree: 1, }
|
||||
}
|
||||
|
||||
/// Skips the subtree of types corresponding to the last type
|
||||
|
|
|
|||
|
|
@ -201,11 +201,11 @@ fn implied_bounds_from_components<'tcx>(sub_region: &'tcx ty::Region,
|
|||
.flat_map(|component| {
|
||||
match component {
|
||||
Component::Region(r) =>
|
||||
vec!(ImpliedBound::RegionSubRegion(sub_region, r)),
|
||||
vec![ImpliedBound::RegionSubRegion(sub_region, r)],
|
||||
Component::Param(p) =>
|
||||
vec!(ImpliedBound::RegionSubParam(sub_region, p)),
|
||||
vec![ImpliedBound::RegionSubParam(sub_region, p)],
|
||||
Component::Projection(p) =>
|
||||
vec!(ImpliedBound::RegionSubProjection(sub_region, p)),
|
||||
vec![ImpliedBound::RegionSubProjection(sub_region, p)],
|
||||
Component::EscapingProjection(_) =>
|
||||
// If the projection has escaping regions, don't
|
||||
// try to infer any implied bounds even for its
|
||||
|
|
@ -215,9 +215,9 @@ fn implied_bounds_from_components<'tcx>(sub_region: &'tcx ty::Region,
|
|||
// idea is that the WAY that the caller proves
|
||||
// that may change in the future and we want to
|
||||
// give ourselves room to get smarter here.
|
||||
vec!(),
|
||||
vec![],
|
||||
Component::UnresolvedInferenceVariable(..) =>
|
||||
vec!(),
|
||||
vec![],
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue