Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Commit

Permalink
Switch from serde_macros to serde_derive
Browse files Browse the repository at this point in the history
Also run `cargo update` to update dependencies and purge unused
dependencies.
  • Loading branch information
FraGag committed Dec 18, 2016
1 parent e94469d commit 3cba81d
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 98 deletions.
125 changes: 49 additions & 76 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ exclude = [".travis.yml"]

[features]
default = ["serde_codegen"]
unstable = ["serde_macros"]
unstable = ["serde_derive"]

[dependencies]
clap = "2.5"
hyper = "0.9"
mime = "0.2"
quick-error = "1.0"
serde = "0.8"
serde_derive = { version = "0.8", optional = true }
serde_json = "0.8"
serde_macros = { version = "0.8", optional = true }
serde_yaml = "0.4"
syndication = "0.3"
url = { version = "1.2", features = ["serde"] }
Expand Down
24 changes: 8 additions & 16 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
#[cfg(not(feature = "serde_macros"))]
mod inner {
#[cfg(feature = "serde_codegen")]
fn main() {
extern crate serde_codegen;

use std::env;
use std::path::Path;

pub fn main() {
let out_dir = env::var_os("OUT_DIR").unwrap();

let src = Path::new("src/main.rs.in");
let dst = Path::new(&out_dir).join("main.rs");
let out_dir = env::var_os("OUT_DIR").unwrap();

serde_codegen::expand(&src, &dst).unwrap();
}
}
let src = Path::new("src/main.rs.in");
let dst = Path::new(&out_dir).join("main.rs");

#[cfg(feature = "serde_macros")]
mod inner {
pub fn main() {}
serde_codegen::expand(&src, &dst).unwrap();
}

fn main() {
inner::main();
}
#[cfg(not(feature = "serde_codegen"))]
fn main() {}
10 changes: 6 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![cfg_attr(feature = "serde_macros", feature(custom_derive, plugin))]
#![cfg_attr(feature = "serde_macros", plugin(serde_macros))]
#![cfg_attr(feature = "serde_derive", feature(proc_macro))]

#![allow(unknown_lints)]

Expand All @@ -18,13 +17,16 @@ extern crate mime;
#[macro_use]
extern crate quick_error;
extern crate serde;
#[cfg(feature = "serde_derive")]
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate serde_yaml;
extern crate syndication;
extern crate url;

#[cfg(feature = "serde_macros")]
#[cfg(feature = "serde_derive")]
include!("main.rs.in");

#[cfg(not(feature = "serde_macros"))]
#[cfg(feature = "serde_codegen")]
include!(concat!(env!("OUT_DIR"), "/main.rs"));

0 comments on commit 3cba81d

Please sign in to comment.