Skip to content

Commit

Permalink
Auto merge of #52802 - kennytm:rollup, r=kennytm
Browse files Browse the repository at this point in the history
Rollup of 11 pull requests

Successful merges:

 - #52702 (Suggest fix when encountering different mutability from impl to trait)
 - #52703 (Improve a few vectors - calculate capacity or build from iterators)
 - #52740 (Suggest underscore when using dashes in crate namet push fork)
 - #52759 (Impl Send & Sync for JoinHandle)
 - #52760 (rustc_metadata: test loading atoi instead of cos)
 - #52763 (Omit the vendor component in Fuchsia triple)
 - #52765 (Remove unused "-Zenable_nonzeroing_move_hints" flag)
 - #52769 (Incorporate a stray test)
 - #52777 (Fix doc comment for 'ptr::copy_to' method)
 - #52779 (revert accidental atty downgrade)
 - #52781 (Use a slice where a vector is not necessary)

Failed merges:

r? @ghost
  • Loading branch information
bors committed Jul 28, 2018
2 parents 0560747 + 59f8422 commit cc22428
Show file tree
Hide file tree
Showing 43 changed files with 185 additions and 113 deletions.
14 changes: 7 additions & 7 deletions src/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ dependencies = [

[[package]]
name = "atty"
version = "0.2.10"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -187,7 +187,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "cargo"
version = "0.30.0"
dependencies = [
"atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -303,7 +303,7 @@ version = "2.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -622,7 +622,7 @@ name = "env_logger"
version = "0.5.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -1844,7 +1844,7 @@ name = "rustc-ap-rustc_errors"
version = "182.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-ap-rustc_data_structures 182.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-ap-serialize 182.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-ap-syntax_pos 182.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down Expand Up @@ -2097,7 +2097,7 @@ dependencies = [
name = "rustc_errors"
version = "0.0.0"
dependencies = [
"atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_data_structures 0.0.0",
"serialize 0.0.0",
"syntax_pos 0.0.0",
Expand Down Expand Up @@ -3056,7 +3056,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
"checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef"
"checksum assert_cli 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "98589b0e465a6c510d95fceebd365bb79bedece7f6e18a480897f2015f85ec51"
"checksum atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2fc4a1aa4c24c0718a250f0681885c1af91419d242f29eb8f2ab28502d80dbd1"
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a"
"checksum backtrace-sys 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)" = "bff67d0c06556c0b8e6b5f090f0eac52d950d9dfd1d35ba04e4ca3543eaf6a7e"
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
Expand Down
16 changes: 8 additions & 8 deletions src/ci/docker/dist-various-2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

ENV \
AR_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-ar \
CC_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-clang \
CXX_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-clang++ \
AR_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-ar \
CC_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-clang \
CXX_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-clang++ \
AR_x86_64_fuchsia=x86_64-fuchsia-ar \
CC_x86_64_fuchsia=x86_64-fuchsia-clang \
CXX_x86_64_fuchsia=x86_64-fuchsia-clang++ \
AR_aarch64_fuchsia=aarch64-fuchsia-ar \
CC_aarch64_fuchsia=aarch64-fuchsia-clang \
CXX_aarch64_fuchsia=aarch64-fuchsia-clang++ \
AR_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-ar \
CC_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-gcc \
CXX_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-g++ \
AR_x86_64_sun_solaris=x86_64-sun-solaris2.10-ar \
CC_x86_64_sun_solaris=x86_64-sun-solaris2.10-gcc \
CXX_x86_64_sun_solaris=x86_64-sun-solaris2.10-g++

ENV TARGETS=x86_64-unknown-fuchsia
ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia
ENV TARGETS=x86_64-fuchsia
ENV TARGETS=$TARGETS,aarch64-fuchsia
ENV TARGETS=$TARGETS,sparcv9-sun-solaris
ENV TARGETS=$TARGETS,wasm32-unknown-unknown
ENV TARGETS=$TARGETS,x86_64-sun-solaris
Expand Down
10 changes: 5 additions & 5 deletions src/ci/docker/dist-various-2/build-fuchsia-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ build() {
esac

hide_output make -j$(getconf _NPROCESSORS_ONLN) $tgt
dst=/usr/local/${arch}-unknown-fuchsia
dst=/usr/local/${arch}-fuchsia
mkdir -p $dst
cp -a build-${tgt}/sysroot/include $dst/
cp -a build-${tgt}/sysroot/lib $dst/
Expand All @@ -55,11 +55,11 @@ rm -rf zircon

for arch in x86_64 aarch64; do
for tool in clang clang++; do
cat >/usr/local/bin/${arch}-unknown-fuchsia-${tool} <<EOF
cat >/usr/local/bin/${arch}-fuchsia-${tool} <<EOF
#!/bin/sh
${tool} --target=${arch}-unknown-fuchsia --sysroot=/usr/local/${arch}-unknown-fuchsia "\$@"
${tool} --target=${arch}-fuchsia --sysroot=/usr/local/${arch}-fuchsia "\$@"
EOF
chmod +x /usr/local/bin/${arch}-unknown-fuchsia-${tool}
chmod +x /usr/local/bin/${arch}-fuchsia-${tool}
done
ln -s /usr/local/bin/llvm-ar /usr/local/bin/${arch}-unknown-fuchsia-ar
ln -s /usr/local/bin/llvm-ar /usr/local/bin/${arch}-fuchsia-ar
done
1 change: 1 addition & 0 deletions src/liballoc/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#![feature(try_reserve)]
#![feature(unboxed_closures)]
#![feature(exact_chunks)]
#![feature(repeat_generic_slice)]

extern crate alloc_system;
extern crate core;
Expand Down
11 changes: 11 additions & 0 deletions src/liballoc/tests/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1529,3 +1529,14 @@ fn panic_safe() {
}
}
}

#[test]
fn repeat_generic_slice() {
assert_eq!([1, 2].repeat(2), vec![1, 2, 1, 2]);
assert_eq!([1, 2, 3, 4].repeat(0), vec![]);
assert_eq!([1, 2, 3, 4].repeat(1), vec![1, 2, 3, 4]);
assert_eq!(
[1, 2, 3, 4].repeat(3),
vec![1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]
);
}
4 changes: 2 additions & 2 deletions src/libcore/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1162,8 +1162,8 @@ impl<T: ?Sized> *const T {
///
/// Care must be taken with the ownership of `self` and `dest`.
/// This method semantically moves the values of `self` into `dest`.
/// However it does not drop the contents of `self`, or prevent the contents
/// of `dest` from being dropped or used.
/// However it does not drop the contents of `dest`, or prevent the contents
/// of `self` from being dropped or used.
///
/// # Examples
///
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ impl<'a> LoweringContext<'a> {
// This is used to track which lifetimes have already been defined, and
// which are new in-band lifetimes that need to have a definition created
// for them.
fn with_in_scope_lifetime_defs<T, F>(&mut self, params: &Vec<GenericParam>, f: F) -> T
fn with_in_scope_lifetime_defs<T, F>(&mut self, params: &[GenericParam], f: F) -> T
where
F: FnOnce(&mut LoweringContext) -> T,
{
Expand Down Expand Up @@ -2237,7 +2237,7 @@ impl<'a> LoweringContext<'a> {

fn lower_generic_params(
&mut self,
params: &Vec<GenericParam>,
params: &[GenericParam],
add_bounds: &NodeMap<Vec<GenericBound>>,
mut itctx: ImplTraitContext,
) -> hir::HirVec<hir::GenericParam> {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/map/hir_id_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl<'a, 'hir: 'a> HirIdValidator<'a, 'hir> {
.collect();

// Try to map those to something more useful
let mut missing_items = vec![];
let mut missing_items = Vec::with_capacity(missing.len());

for local_id in missing {
let hir_id = HirId {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ich/hcx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for Span {
pub fn hash_stable_trait_impls<'a, 'gcx, W, R>(
hcx: &mut StableHashingContext<'a>,
hasher: &mut StableHasher<W>,
blanket_impls: &Vec<DefId>,
blanket_impls: &[DefId],
non_blanket_impls: &HashMap<fast_reject::SimplifiedType, Vec<DefId>, R>)
where W: StableHasherResult,
R: std_hash::BuildHasher,
Expand Down
6 changes: 1 addition & 5 deletions src/librustc/infer/outlives/obligations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,11 +505,7 @@ where
}

fn recursive_type_bound(&self, ty: Ty<'tcx>) -> VerifyBound<'tcx> {
let mut bounds = vec![];

for subty in ty.walk_shallow() {
bounds.push(self.type_bound(subty));
}
let mut bounds = ty.walk_shallow().map(|subty| self.type_bound(subty)).collect::<Vec<_>>();

let mut regions = ty.regions();
regions.retain(|r| !r.is_late_bound()); // ignore late-bound regions
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/lint/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ impl LintStore {
}
}

let mut future_incompatible = vec![];
let mut future_incompatible = Vec::with_capacity(lints.len());
for lint in lints {
future_incompatible.push(lint.id);
self.future_incompatible.insert(lint.id, lint);
Expand Down
6 changes: 0 additions & 6 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1247,8 +1247,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"for every macro invocation, print its name and arguments"),
debug_macros: bool = (false, parse_bool, [TRACKED],
"emit line numbers debug info inside macros"),
enable_nonzeroing_move_hints: bool = (false, parse_bool, [TRACKED],
"force nonzeroing move optimization on"),
keep_hygiene_data: bool = (false, parse_bool, [UNTRACKED],
"don't clear the hygiene data after analysis"),
keep_ast: bool = (false, parse_bool, [UNTRACKED],
Expand Down Expand Up @@ -3168,10 +3166,6 @@ mod tests {
opts.debugging_opts.force_overflow_checks = Some(true);
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());

opts = reference.clone();
opts.debugging_opts.enable_nonzeroing_move_hints = true;
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());

opts = reference.clone();
opts.debugging_opts.show_span = Some(String::from("abc"));
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
Expand Down
3 changes: 0 additions & 3 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -624,9 +624,6 @@ impl Session {
pub fn unstable_options(&self) -> bool {
self.opts.debugging_opts.unstable_options
}
pub fn nonzeroing_move_hints(&self) -> bool {
self.opts.debugging_opts.enable_nonzeroing_move_hints
}
pub fn overflow_checks(&self) -> bool {
self.opts
.cg
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/traits/error_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use syntax_pos::{DUMMY_SP, Span};

impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
pub fn report_fulfillment_errors(&self,
errors: &Vec<FulfillmentError<'tcx>>,
errors: &[FulfillmentError<'tcx>],
body_id: Option<hir::BodyId>,
fallback_has_occurred: bool) {
#[derive(Debug)]
Expand Down Expand Up @@ -1015,7 +1015,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
) -> DiagnosticBuilder<'tcx> {
let kind = if is_closure { "closure" } else { "function" };

let args_str = |arguments: &Vec<ArgKind>, other: &Vec<ArgKind>| {
let args_str = |arguments: &[ArgKind], other: &[ArgKind]| {
let arg_length = arguments.len();
let distinct = match &other[..] {
&[ArgKind::Tuple(..)] => true,
Expand Down
11 changes: 4 additions & 7 deletions src/librustc/traits/object_safety.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
pub fn astconv_object_safety_violations(self, trait_def_id: DefId)
-> Vec<ObjectSafetyViolation>
{
let mut violations = vec![];

for def_id in traits::supertrait_def_ids(self, trait_def_id) {
if self.predicates_reference_self(def_id, true) {
violations.push(ObjectSafetyViolation::SupertraitSelf);
}
}
let violations = traits::supertrait_def_ids(self, trait_def_id)
.filter(|&def_id| self.predicates_reference_self(def_id, true))
.map(|_| ObjectSafetyViolation::SupertraitSelf)
.collect();

debug!("astconv_object_safety_violations(trait_def_id={:?}) = {:?}",
trait_def_id,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_borrowck/borrowck/gather_loans/move_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub struct GroupedMoveErrors<'tcx> {
move_to_places: Vec<MovePlace<'tcx>>
}

fn report_move_errors<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, errors: &Vec<MoveError<'tcx>>) {
fn report_move_errors<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, errors: &[MoveError<'tcx>]) {
let grouped_errors = group_errors_with_same_origin(errors);
for error in &grouped_errors {
let mut err = report_cannot_move_out_of(bccx, error.move_from.clone());
Expand Down Expand Up @@ -103,7 +103,7 @@ fn report_move_errors<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, errors: &Vec<Move
}
}

fn group_errors_with_same_origin<'tcx>(errors: &Vec<MoveError<'tcx>>)
fn group_errors_with_same_origin<'tcx>(errors: &[MoveError<'tcx>])
-> Vec<GroupedMoveErrors<'tcx>> {
let mut grouped_errors = Vec::new();
for error in errors {
Expand Down
5 changes: 3 additions & 2 deletions src/librustc_codegen_llvm/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ use std::env;
use std::fmt;
use std::fs;
use std::io;
use std::iter;
use std::path::{Path, PathBuf};
use std::process::{Output, Stdio};
use std::str;
Expand Down Expand Up @@ -885,9 +886,9 @@ fn exec_linker(sess: &Session, cmd: &mut Command, out_filename: &Path, tmpdir: &
}
let file = tmpdir.join("linker-arguments");
let bytes = if sess.target.target.options.is_like_msvc {
let mut out = vec![];
let mut out = Vec::with_capacity((1 + args.len()) * 2);
// start the stream with a UTF-16 BOM
for c in vec![0xFEFF].into_iter().chain(args.encode_utf16()) {
for c in iter::once(0xFEFF).chain(args.encode_utf16()) {
// encode in little endian
out.push(c as u8);
out.push((c >> 8) as u8);
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,7 @@ fn generated_output_paths(

// Runs `f` on every output file path and returns the first non-None result, or None if `f`
// returns None for every file path.
fn check_output<F, T>(output_paths: &Vec<PathBuf>, f: F) -> Option<T>
fn check_output<F, T>(output_paths: &[PathBuf], f: F) -> Option<T>
where
F: Fn(&PathBuf) -> Option<T>,
{
Expand All @@ -1407,7 +1407,7 @@ where
None
}

pub fn output_contains_path(output_paths: &Vec<PathBuf>, input_path: &PathBuf) -> bool {
pub fn output_contains_path(output_paths: &[PathBuf], input_path: &PathBuf) -> bool {
let input_path = input_path.canonicalize().ok();
if input_path.is_none() {
return false;
Expand All @@ -1422,7 +1422,7 @@ pub fn output_contains_path(output_paths: &Vec<PathBuf>, input_path: &PathBuf) -
check_output(output_paths, check).is_some()
}

pub fn output_conflicts_with_dir(output_paths: &Vec<PathBuf>) -> Option<PathBuf> {
pub fn output_conflicts_with_dir(output_paths: &[PathBuf]) -> Option<PathBuf> {
let check = |output_path: &PathBuf| {
if output_path.is_dir() {
Some(output_path.clone())
Expand All @@ -1433,7 +1433,7 @@ pub fn output_conflicts_with_dir(output_paths: &Vec<PathBuf>) -> Option<PathBuf>
check_output(output_paths, check)
}

fn write_out_deps(sess: &Session, outputs: &OutputFilenames, out_filenames: &Vec<PathBuf>) {
fn write_out_deps(sess: &Session, outputs: &OutputFilenames, out_filenames: &[PathBuf]) {
// Write out dependency rules to the dep-info file if requested
if !sess.opts.output_types.contains_key(&OutputType::DepInfo) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_driver/profile/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct StackFrame {
pub traces: Vec<trace::Rec>,
}

fn total_duration(traces: &Vec<trace::Rec>) -> Duration {
fn total_duration(traces: &[trace::Rec]) -> Duration {
let mut sum : Duration = Duration::new(0,0);
for t in traces.iter() { sum += t.dur_total; }
return sum
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_driver/profile/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ fn html_of_fraction(frac: f64) -> (String, String) {
else { (format!("< 0.1%", ), css) }
}

fn total_duration(traces: &Vec<Rec>) -> Duration {
fn total_duration(traces: &[Rec]) -> Duration {
let mut sum : Duration = Duration::new(0,0);
for t in traces.iter() {
sum += t.dur_total;
Expand All @@ -123,7 +123,7 @@ fn duration_div(nom: Duration, den: Duration) -> f64 {
to_nanos(nom) as f64 / to_nanos(den) as f64
}

fn write_traces_rec(file: &mut File, traces: &Vec<Rec>, total: Duration, depth: usize) {
fn write_traces_rec(file: &mut File, traces: &[Rec], total: Duration, depth: usize) {
for t in traces {
let (eff_text, eff_css_classes) = html_of_effect(&t.effect);
let (dur_text, dur_css_classes) = html_of_duration(&t.start, &t.dur_total);
Expand All @@ -149,7 +149,7 @@ fn write_traces_rec(file: &mut File, traces: &Vec<Rec>, total: Duration, depth:
}
}

fn compute_counts_rec(counts: &mut HashMap<String,QueryMetric>, traces: &Vec<Rec>) {
fn compute_counts_rec(counts: &mut HashMap<String,QueryMetric>, traces: &[Rec]) {
for t in traces.iter() {
match t.effect {
Effect::TimeBegin(ref msg) => {
Expand Down Expand Up @@ -218,7 +218,7 @@ pub fn write_counts(count_file: &mut File, counts: &mut HashMap<String,QueryMetr
}
}

pub fn write_traces(html_file: &mut File, counts_file: &mut File, traces: &Vec<Rec>) {
pub fn write_traces(html_file: &mut File, counts_file: &mut File, traces: &[Rec]) {
let capacity = traces.iter().fold(0, |acc, t| acc + 1 + t.extent.len());
let mut counts : HashMap<String, QueryMetric> = HashMap::with_capacity(capacity);
compute_counts_rec(&mut counts, traces);
Expand Down
Loading

0 comments on commit cc22428

Please sign in to comment.