Update cargo-metadata

This commit is contained in:
Edwin Cheng 2020-05-10 06:22:26 +08:00
parent 8295a9340c
commit 2400d70442
9 changed files with 28 additions and 41 deletions

View file

@ -20,26 +20,15 @@ SUBTREE $
PUNCH = [alone] 4294967295
SUBTREE {} 4294967295
PUNCH # [alone] 4294967295
SUBTREE [] 4294967295
IDENT allow 4294967295
SUBTREE () 4294967295
IDENT unknown_lints 4294967295
PUNCH # [alone] 4294967295
SUBTREE [] 4294967295
IDENT cfg_attr 4294967295
SUBTREE () 4294967295
IDENT feature 4294967295
PUNCH = [alone] 4294967295
LITERAL "cargo-clippy" 0
PUNCH , [alone] 4294967295
IDENT allow 4294967295
SUBTREE () 4294967295
IDENT useless_attribute 4294967295
PUNCH # [alone] 4294967295
SUBTREE [] 4294967295
IDENT allow 4294967295
SUBTREE () 4294967295
IDENT rust_2018_idioms 4294967295
PUNCH , [alone] 4294967295
IDENT clippy 4294967295
PUNCH : [joint] 4294967295
PUNCH : [alone] 4294967295
IDENT useless_attribute 4294967295
IDENT extern 4294967295
IDENT crate 4294967295
IDENT serde 4294967295

View file

@ -10,7 +10,7 @@ fn test_derive_serialize_proc_macro() {
assert_expand(
"serde_derive",
"Serialize",
"1.0.106",
"1.0",
r##"struct Foo {}"##,
include_str!("fixtures/test_serialize_proc_macro.txt"),
);
@ -21,7 +21,7 @@ fn test_derive_serialize_proc_macro_failed() {
assert_expand(
"serde_derive",
"Serialize",
"1.0.106",
"1.0",
r##"
struct {}
"##,
@ -37,7 +37,7 @@ SUBTREE $
#[test]
fn test_derive_proc_macro_list() {
let res = list("serde_derive", "1.0.106").join("\n");
let res = list("serde_derive", "1.0").join("\n");
assert_eq_text!(
&res,

View file

@ -8,7 +8,7 @@ use std::str::FromStr;
use test_utils::assert_eq_text;
mod fixtures {
use cargo_metadata::{parse_messages, Message};
use cargo_metadata::Message;
use std::process::Command;
// Use current project metadata to get the proc-macro dylib path
@ -19,12 +19,12 @@ mod fixtures {
.unwrap()
.stdout;
for message in parse_messages(command.as_slice()) {
for message in Message::parse_stream(command.as_slice()) {
match message.unwrap() {
Message::CompilerArtifact(artifact) => {
if artifact.target.kind.contains(&"proc-macro".to_string()) {
let repr = format!("{} {}", crate_name, version);
if artifact.package_id.repr.starts_with(&repr) {
if artifact.package_id.repr.starts_with(dbg!(&repr)) {
return artifact.filenames[0].clone();
}
}