Skip to content

Commit

Permalink
Auto merge of #6916 - matthiaskrgr:single_largest, r=alexcrichton
Browse files Browse the repository at this point in the history
crate download: don't print that a crate was the largest download if it was the only download

    before:

        Updating crates.io index
      Downloaded procs v0.8.4
      Downloaded 1 crates (1.1 MB) in 2.90s (largest was `procs` at 1.1 MB)
      Installing procs v0.8.4

    after:

        Updating crates.io index
      Downloaded procs v0.8.4
      Downloaded 1 crates (1.1 MB) in 1.50s
      Installing procs v0.8.4
  • Loading branch information
bors committed May 8, 2019
2 parents 759b616 + a7d7821 commit 345d570
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/cargo/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pub use self::features::{
enable_nightly_features, maybe_allow_nightly_features, nightly_features_allowed,
};
pub use self::features::{CliUnstable, Edition, Feature, Features};
pub use self::interning::InternedString;
pub use self::manifest::{EitherManifest, VirtualManifest};
pub use self::manifest::{LibKind, Manifest, Target, TargetKind};
pub use self::package::{Package, PackageSet};
Expand All @@ -14,7 +15,6 @@ pub use self::shell::{Shell, Verbosity};
pub use self::source::{GitReference, Source, SourceId, SourceMap};
pub use self::summary::{FeatureMap, FeatureValue, Summary};
pub use self::workspace::{Members, Workspace, WorkspaceConfig, WorkspaceRootConfig};
pub use self::interning::InternedString;

pub mod compiler;
pub mod dependency;
Expand Down
7 changes: 5 additions & 2 deletions src/cargo/core/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ use crate::core::source::MaybePackage;
use crate::core::{Dependency, Manifest, PackageId, SourceId, Target};
use crate::core::{FeatureMap, SourceMap, Summary};
use crate::ops;
use crate::util::config::PackageCacheLock;
use crate::util::errors::{CargoResult, CargoResultExt, HttpNot200};
use crate::util::network::Retry;
use crate::util::{self, internal, lev_distance, Config, Progress, ProgressStyle};
use crate::util::config::PackageCacheLock;

/// Information about a package that is available somewhere in the file system.
///
Expand Down Expand Up @@ -951,7 +951,10 @@ impl<'a, 'cfg> Drop for Downloads<'a, 'cfg> {
ByteSize(self.downloaded_bytes),
util::elapsed(self.start.elapsed())
);
if self.largest.0 > ByteSize::mb(1).0 {
// print the size of largest crate if it was >1mb
// however don't print if only a single crate was downloaded
// because it is obvious that it will be the largest then
if self.largest.0 > ByteSize::mb(1).0 && self.downloads_finished > 1 {
status.push_str(&format!(
" (largest was `{}` at {})",
self.largest.1,
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/sources/registry/local.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::core::{PackageId, InternedString};
use crate::core::{InternedString, PackageId};
use crate::sources::registry::{MaybeLock, RegistryConfig, RegistryData};
use crate::util::errors::{CargoResult, CargoResultExt};
use crate::util::paths;
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/sources/registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ use tar::Archive;

use crate::core::dependency::{Dependency, Kind};
use crate::core::source::MaybePackage;
use crate::core::{Package, PackageId, Source, SourceId, Summary, InternedString};
use crate::core::{InternedString, Package, PackageId, Source, SourceId, Summary};
use crate::sources::PathSource;
use crate::util::errors::CargoResultExt;
use crate::util::hex;
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/sources/registry/remote.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::core::{PackageId, SourceId, InternedString};
use crate::core::{InternedString, PackageId, SourceId};
use crate::sources::git;
use crate::sources::registry::MaybeLock;
use crate::sources::registry::{RegistryConfig, RegistryData, CRATE_TEMPLATE, VERSION_TEMPLATE};
Expand Down
4 changes: 1 addition & 3 deletions tests/testsuite/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1957,9 +1957,7 @@ fn rename_deps_and_features() {
#[test]
fn ignore_invalid_json_lines() {
Package::new("foo", "0.1.0").publish();
Package::new("foo", "0.1.1")
.invalid_json(true)
.publish();
Package::new("foo", "0.1.1").invalid_json(true).publish();
Package::new("foo", "0.2.0").publish();

let p = project()
Expand Down

0 comments on commit 345d570

Please sign in to comment.