Skip to content

Commit 345d570

Browse files
committed
Auto merge of #6916 - matthiaskrgr:single_largest, r=alexcrichton
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
2 parents 759b616 + a7d7821 commit 345d570

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

src/cargo/core/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pub use self::features::{
33
enable_nightly_features, maybe_allow_nightly_features, nightly_features_allowed,
44
};
55
pub use self::features::{CliUnstable, Edition, Feature, Features};
6+
pub use self::interning::InternedString;
67
pub use self::manifest::{EitherManifest, VirtualManifest};
78
pub use self::manifest::{LibKind, Manifest, Target, TargetKind};
89
pub use self::package::{Package, PackageSet};
@@ -14,7 +15,6 @@ pub use self::shell::{Shell, Verbosity};
1415
pub use self::source::{GitReference, Source, SourceId, SourceMap};
1516
pub use self::summary::{FeatureMap, FeatureValue, Summary};
1617
pub use self::workspace::{Members, Workspace, WorkspaceConfig, WorkspaceRootConfig};
17-
pub use self::interning::InternedString;
1818

1919
pub mod compiler;
2020
pub mod dependency;

src/cargo/core/package.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ use crate::core::source::MaybePackage;
2222
use crate::core::{Dependency, Manifest, PackageId, SourceId, Target};
2323
use crate::core::{FeatureMap, SourceMap, Summary};
2424
use crate::ops;
25+
use crate::util::config::PackageCacheLock;
2526
use crate::util::errors::{CargoResult, CargoResultExt, HttpNot200};
2627
use crate::util::network::Retry;
2728
use crate::util::{self, internal, lev_distance, Config, Progress, ProgressStyle};
28-
use crate::util::config::PackageCacheLock;
2929

3030
/// Information about a package that is available somewhere in the file system.
3131
///
@@ -951,7 +951,10 @@ impl<'a, 'cfg> Drop for Downloads<'a, 'cfg> {
951951
ByteSize(self.downloaded_bytes),
952952
util::elapsed(self.start.elapsed())
953953
);
954-
if self.largest.0 > ByteSize::mb(1).0 {
954+
// print the size of largest crate if it was >1mb
955+
// however don't print if only a single crate was downloaded
956+
// because it is obvious that it will be the largest then
957+
if self.largest.0 > ByteSize::mb(1).0 && self.downloads_finished > 1 {
955958
status.push_str(&format!(
956959
" (largest was `{}` at {})",
957960
self.largest.1,

src/cargo/sources/registry/local.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::core::{PackageId, InternedString};
1+
use crate::core::{InternedString, PackageId};
22
use crate::sources::registry::{MaybeLock, RegistryConfig, RegistryData};
33
use crate::util::errors::{CargoResult, CargoResultExt};
44
use crate::util::paths;

src/cargo/sources/registry/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ use tar::Archive;
173173

174174
use crate::core::dependency::{Dependency, Kind};
175175
use crate::core::source::MaybePackage;
176-
use crate::core::{Package, PackageId, Source, SourceId, Summary, InternedString};
176+
use crate::core::{InternedString, Package, PackageId, Source, SourceId, Summary};
177177
use crate::sources::PathSource;
178178
use crate::util::errors::CargoResultExt;
179179
use crate::util::hex;

src/cargo/sources/registry/remote.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::core::{PackageId, SourceId, InternedString};
1+
use crate::core::{InternedString, PackageId, SourceId};
22
use crate::sources::git;
33
use crate::sources::registry::MaybeLock;
44
use crate::sources::registry::{RegistryConfig, RegistryData, CRATE_TEMPLATE, VERSION_TEMPLATE};

tests/testsuite/registry.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1957,9 +1957,7 @@ fn rename_deps_and_features() {
19571957
#[test]
19581958
fn ignore_invalid_json_lines() {
19591959
Package::new("foo", "0.1.0").publish();
1960-
Package::new("foo", "0.1.1")
1961-
.invalid_json(true)
1962-
.publish();
1960+
Package::new("foo", "0.1.1").invalid_json(true).publish();
19631961
Package::new("foo", "0.2.0").publish();
19641962

19651963
let p = project()

0 commit comments

Comments
 (0)