Skip to content

Commit 4bda11a

Browse files
authored
1 parent 6517b76 commit 4bda11a

40 files changed

+1713
-859
lines changed

crate_universe/src/config.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
use std::cmp::Ordering;
44
use std::collections::{BTreeMap, BTreeSet};
5-
use std::convert::AsRef;
65
use std::fmt::Formatter;
76
use std::iter::Sum;
87
use std::ops::Add;

crate_universe/src/context.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use anyhow::Result;
1111
use serde::{Deserialize, Serialize};
1212

1313
use crate::config::CrateId;
14-
use crate::context::crate_context::{CrateContext, CrateDependency, Rule};
1514
use crate::context::platforms::resolve_cfg_platforms;
1615
use crate::lockfile::Digest;
1716
use crate::metadata::{Annotations, Dependency};

crate_universe/src/context/crate_context.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ impl CrateContext {
629629

630630
// Git shallow_since
631631
if let Some(SourceAnnotation::Git { shallow_since, .. }) = &mut self.repository {
632-
*shallow_since = crate_extra.shallow_since.clone()
632+
shallow_since.clone_from(&crate_extra.shallow_since);
633633
}
634634

635635
// Patch attributes
@@ -641,19 +641,19 @@ impl CrateContext {
641641
patches,
642642
..
643643
} => {
644-
*patch_args = crate_extra.patch_args.clone();
645-
*patch_tool = crate_extra.patch_tool.clone();
646-
*patches = crate_extra.patches.clone();
644+
patch_args.clone_from(&crate_extra.patch_args);
645+
patch_tool.clone_from(&crate_extra.patch_tool);
646+
patches.clone_from(&crate_extra.patches);
647647
}
648648
SourceAnnotation::Http {
649649
patch_args,
650650
patch_tool,
651651
patches,
652652
..
653653
} => {
654-
*patch_args = crate_extra.patch_args.clone();
655-
*patch_tool = crate_extra.patch_tool.clone();
656-
*patches = crate_extra.patches.clone();
654+
patch_args.clone_from(&crate_extra.patch_args);
655+
patch_tool.clone_from(&crate_extra.patch_tool);
656+
patches.clone_from(&crate_extra.patches);
657657
}
658658
}
659659
}

crate_universe/src/lockfile.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! Utility module for interacting with the cargo-bazel lockfile.
22
33
use std::collections::BTreeMap;
4-
use std::convert::TryFrom;
54
use std::ffi::OsStr;
65
use std::fs;
76
use std::path::Path;
@@ -193,7 +192,7 @@ mod test {
193192

194193
use super::*;
195194

196-
use std::collections::{BTreeMap, BTreeSet};
195+
use std::collections::BTreeSet;
197196

198197
#[test]
199198
fn simple_digest() {

crate_universe/src/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl Cargo {
169169
let version_str = full_version.split(' ').nth(1);
170170
if let Some(version_str) = version_str {
171171
let version = Version::parse(version_str).context("Failed to parse cargo version")?;
172-
return Ok(version.major >= 1 && version.minor >= 78);
172+
return Ok(version.major >= 1 && version.minor >= 77);
173173
}
174174
bail!("Couldn't parse cargo version");
175175
}

crate_universe/src/metadata/dependency.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,6 @@ fn get_target_alias(target_name: &str, package: &Package) -> Option<String> {
285285

286286
#[cfg(test)]
287287
mod test {
288-
use std::collections::BTreeSet;
289-
290288
use super::*;
291289

292290
use crate::test::*;

crate_universe/src/metadata/metadata_annotation.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! Collect and store information from Cargo metadata specific to Bazel's needs
22
33
use std::collections::{BTreeMap, BTreeSet};
4-
use std::convert::TryFrom;
54
use std::path::PathBuf;
65

76
use anyhow::{bail, Result};

crate_universe/src/rendering.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ mod template_engine;
44

55
use std::collections::{BTreeMap, BTreeSet};
66
use std::fs;
7-
use std::iter::FromIterator;
87
use std::path::{Path, PathBuf};
98
use std::str::FromStr;
109

@@ -902,11 +901,9 @@ mod test {
902901
use super::*;
903902

904903
use indoc::indoc;
905-
use std::collections::BTreeSet;
906904

907-
use crate::config::{Config, CrateId, VendorMode};
908-
use crate::context::crate_context::{CrateContext, Rule};
909-
use crate::context::{BuildScriptAttributes, CommonAttributes, Context, TargetAttributes};
905+
use crate::config::{Config, CrateId};
906+
use crate::context::{BuildScriptAttributes, CommonAttributes};
910907
use crate::metadata::Annotations;
911908
use crate::test;
912909

@@ -1312,7 +1309,7 @@ mod test {
13121309
assert!(!defs_module.contains("def crate_repositories():"));
13131310

13141311
// Local vendoring does not produce a `crates.bzl` file.
1315-
assert!(output.get(&PathBuf::from("crates.bzl")).is_none());
1312+
assert!(!output.contains_key(&PathBuf::from("crates.bzl")));
13161313
}
13171314

13181315
#[test]

crate_universe/src/rendering/template_engine.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
//! A template engine backed by [Tera] for rendering Files.
1+
//! A template engine backed by [tera::Tera] for rendering Files.
22
33
use std::collections::HashMap;
44

55
use anyhow::{Context as AnyhowContext, Result};
66
use serde_json::{from_value, to_value, Value};
7-
use tera::{self, Tera};
87

98
use crate::config::RenderConfig;
109
use crate::context::Context;
@@ -16,13 +15,13 @@ use crate::select::Select;
1615
use crate::utils::sanitize_repository_name;
1716

1817
pub(crate) struct TemplateEngine {
19-
engine: Tera,
18+
engine: tera::Tera,
2019
context: tera::Context,
2120
}
2221

2322
impl TemplateEngine {
2423
pub(crate) fn new(render_config: &RenderConfig) -> Self {
25-
let mut tera = Tera::default();
24+
let mut tera = tera::Tera::default();
2625
tera.add_raw_templates(vec![
2726
(
2827
"partials/module/aliases_map.j2",

crate_universe/src/splicing.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ mod crate_index_lookup;
55
mod splicer;
66

77
use std::collections::{BTreeMap, BTreeSet};
8-
use std::convert::TryFrom;
98
use std::fs;
109
use std::path::{Path, PathBuf};
1110
use std::str::FromStr;
@@ -481,8 +480,6 @@ pub(crate) fn generate_lockfile(
481480
mod test {
482481
use super::*;
483482

484-
use std::path::PathBuf;
485-
486483
#[test]
487484
fn deserialize_splicing_manifest() {
488485
let runfiles = runfiles::Runfiles::create().unwrap();

0 commit comments

Comments
 (0)