Skip to content

Commit 807d7ed

Browse files
committed
refactor(toml): Remove unused Rc
1 parent 2a314c7 commit 807d7ed

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

src/cargo/ops/cargo_package.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use std::fs::{self, File};
33
use std::io::prelude::*;
44
use std::io::SeekFrom;
55
use std::path::{Path, PathBuf};
6-
use std::rc::Rc;
76
use std::sync::Arc;
87
use std::task::Poll;
98

@@ -412,16 +411,14 @@ fn build_lock(ws: &Workspace<'_>, orig_pkg: &Package) -> CargoResult<String> {
412411
let orig_resolve = ops::load_pkg_lockfile(ws)?;
413412

414413
// Convert Package -> TomlManifest -> Manifest -> Package
415-
let toml_manifest = Rc::new(
416-
orig_pkg
417-
.manifest()
418-
.original()
419-
.prepare_for_publish(ws, orig_pkg.root())?,
420-
);
414+
let toml_manifest = orig_pkg
415+
.manifest()
416+
.original()
417+
.prepare_for_publish(ws, orig_pkg.root())?;
421418
let package_root = orig_pkg.root();
422419
let source_id = orig_pkg.package_id().source_id();
423420
let (manifest, _nested_paths) =
424-
TomlManifest::to_real_manifest(&toml_manifest, false, source_id, package_root, config)?;
421+
TomlManifest::to_real_manifest(toml_manifest, false, source_id, package_root, config)?;
425422
let new_pkg = Package::new(manifest, orig_pkg.manifest_path());
426423

427424
let max_rust_version = new_pkg.rust_version().cloned();

src/cargo/util/toml/mod.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ fn read_manifest_from_str(
111111
}
112112
};
113113

114-
let manifest = Rc::new(manifest);
115114
if let Some(deps) = manifest
116115
.workspace
117116
.as_ref()
@@ -128,7 +127,7 @@ fn read_manifest_from_str(
128127
}
129128
return if manifest.project.is_some() || manifest.package.is_some() {
130129
let (mut manifest, paths) = schema::TomlManifest::to_real_manifest(
131-
&manifest,
130+
manifest,
132131
embedded,
133132
source_id,
134133
package_root,
@@ -145,7 +144,7 @@ fn read_manifest_from_str(
145144
Ok((EitherManifest::Real(manifest), paths))
146145
} else {
147146
let (mut m, paths) =
148-
schema::TomlManifest::to_virtual_manifest(&manifest, source_id, package_root, config)?;
147+
schema::TomlManifest::to_virtual_manifest(manifest, source_id, package_root, config)?;
149148
add_unused(m.warnings_mut());
150149
Ok((EitherManifest::Virtual(m), paths))
151150
};
@@ -391,7 +390,7 @@ impl schema::TomlManifest {
391390
}
392391

393392
pub fn to_real_manifest(
394-
me: &Rc<schema::TomlManifest>,
393+
me: schema::TomlManifest,
395394
embedded: bool,
396395
source_id: SourceId,
397396
package_root: &Path,
@@ -603,7 +602,7 @@ impl schema::TomlManifest {
603602
// If we have a lib with no path, use the inferred lib or else the package name.
604603
let targets = targets(
605604
&features,
606-
me,
605+
&me,
607606
package_name,
608607
package_root,
609608
edition,
@@ -1119,7 +1118,7 @@ impl schema::TomlManifest {
11191118
}
11201119

11211120
fn to_virtual_manifest(
1122-
me: &Rc<schema::TomlManifest>,
1121+
me: schema::TomlManifest,
11231122
source_id: SourceId,
11241123
root: &Path,
11251124
config: &Config,

0 commit comments

Comments
 (0)