Remove deserialize
This commit is contained in:
parent
dec44b0656
commit
28defe0fce
@ -8,9 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::de::{self, Deserializer, Visitor};
|
||||
|
||||
use std::any::{Any, TypeId};
|
||||
use std::borrow::Borrow;
|
||||
use std::cell::RefCell;
|
||||
@ -29,29 +26,6 @@ use builder::Step;
|
||||
|
||||
pub struct Interned<T>(usize, PhantomData<*const T>);
|
||||
|
||||
impl<'de> Deserialize<'de> for Interned<String> {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where D: Deserializer<'de>
|
||||
{
|
||||
struct StrVisitor;
|
||||
|
||||
impl<'de> Visitor<'de> for StrVisitor {
|
||||
type Value = &'de str;
|
||||
|
||||
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
formatter.write_str("a str")
|
||||
}
|
||||
|
||||
fn visit_borrowed_str<E>(self, value: &'de str) -> Result<&'de str, E>
|
||||
where E: de::Error
|
||||
{
|
||||
Ok(value)
|
||||
}
|
||||
}
|
||||
|
||||
Ok(INTERNER.intern_str(deserializer.deserialize_str(StrVisitor)?))
|
||||
}
|
||||
}
|
||||
impl Default for Interned<String> {
|
||||
fn default() -> Self {
|
||||
INTERNER.intern_string(String::default())
|
||||
|
@ -16,7 +16,7 @@ use build_helper::output;
|
||||
use serde_json;
|
||||
|
||||
use {Build, Crate};
|
||||
use cache::Interned;
|
||||
use cache::INTERNER;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Output {
|
||||
@ -27,7 +27,7 @@ struct Output {
|
||||
#[derive(Deserialize)]
|
||||
struct Package {
|
||||
id: String,
|
||||
name: Interned<String>,
|
||||
name: String,
|
||||
version: String,
|
||||
source: Option<String>,
|
||||
manifest_path: String,
|
||||
@ -66,15 +66,16 @@ fn build_krate(build: &mut Build, krate: &str) {
|
||||
let mut id2name = HashMap::new();
|
||||
for package in output.packages {
|
||||
if package.source.is_none() {
|
||||
id2name.insert(package.id, package.name);
|
||||
let name = INTERNER.intern_string(package.name);
|
||||
id2name.insert(package.id, name);
|
||||
let mut path = PathBuf::from(package.manifest_path);
|
||||
path.pop();
|
||||
build.crates.insert(package.name, Crate {
|
||||
build_step: format!("build-crate-{}", package.name),
|
||||
doc_step: format!("doc-crate-{}", package.name),
|
||||
test_step: format!("test-crate-{}", package.name),
|
||||
bench_step: format!("bench-crate-{}", package.name),
|
||||
name: package.name,
|
||||
build.crates.insert(name, Crate {
|
||||
build_step: format!("build-crate-{}", name),
|
||||
doc_step: format!("doc-crate-{}", name),
|
||||
test_step: format!("test-crate-{}", name),
|
||||
bench_step: format!("bench-crate-{}", name),
|
||||
name: name,
|
||||
version: package.version,
|
||||
deps: Vec::new(),
|
||||
path: path,
|
||||
|
Loading…
Reference in New Issue
Block a user