Skip to content

Commit c03c85a

Browse files
committed
publish-lockfile: Change default to true.
The feature still needs to be enabled.
1 parent 5f616eb commit c03c85a

File tree

2 files changed

+64
-1
lines changed

2 files changed

+64
-1
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ impl TomlManifest {
10351035
features.require(Feature::publish_lockfile())?;
10361036
b
10371037
}
1038-
None => false,
1038+
None => features.is_enabled(Feature::publish_lockfile()),
10391039
};
10401040

10411041
if summary.features().contains_key("default-features") {

tests/testsuite/publish_lockfile.rs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,3 +414,66 @@ dependencies = [
414414
)
415415
.run();
416416
}
417+
418+
#[test]
419+
fn publish_lockfile_default() {
420+
let p = project()
421+
.file(
422+
"Cargo.toml",
423+
r#"
424+
cargo-features = ["publish-lockfile"]
425+
[package]
426+
name = "foo"
427+
version = "1.0.0"
428+
authors = []
429+
license = "MIT"
430+
description = "foo"
431+
documentation = "foo"
432+
homepage = "foo"
433+
repository = "foo"
434+
"#,
435+
)
436+
.file("src/main.rs", "fn main() {}")
437+
.build();
438+
439+
p.cargo("package -l")
440+
.masquerade_as_nightly_cargo()
441+
.with_stdout(
442+
"\
443+
Cargo.lock
444+
Cargo.toml
445+
src/main.rs
446+
",
447+
)
448+
.run();
449+
450+
let p = project()
451+
.file(
452+
"Cargo.toml",
453+
r#"
454+
cargo-features = ["publish-lockfile"]
455+
[package]
456+
name = "foo"
457+
version = "1.0.0"
458+
authors = []
459+
license = "MIT"
460+
description = "foo"
461+
documentation = "foo"
462+
homepage = "foo"
463+
repository = "foo"
464+
publish-lockfile = false
465+
"#,
466+
)
467+
.file("src/main.rs", "fn main() {}")
468+
.build();
469+
470+
p.cargo("package -l")
471+
.masquerade_as_nightly_cargo()
472+
.with_stdout(
473+
"\
474+
Cargo.toml
475+
src/main.rs
476+
",
477+
)
478+
.run();
479+
}

0 commit comments

Comments
 (0)