Snap for 6533464 from a63779afdc33bad6bcd0c43cc1ecc1b3d8b6cab1 to sdk-release
Change-Id: I9943c81558ea591b5662149a6a3458e721a83746
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 28d7b30..1347e27 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
{
"git": {
- "sha1": "5feb37605c9ec2d237651dbd669e3527566a839e"
+ "sha1": "157559c3faf524ae24f8329537d2a763f6e18931"
}
}
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..4d4b341
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,30 @@
+name: CI
+
+on:
+ push:
+ pull_request:
+ schedule: [cron: "40 1 * * *"]
+
+jobs:
+ test:
+ name: Rust ${{matrix.rust}}
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ rust: [nightly, beta, stable, 1.31.0]
+ steps:
+ - uses: actions/checkout@v2
+ - uses: dtolnay/rust-toolchain@master
+ with:
+ toolchain: ${{matrix.rust}}
+ - run: cargo test
+
+ minimal:
+ name: Minimal versions
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: dtolnay/rust-toolchain@nightly
+ - run: cargo -Z minimal-versions generate-lockfile
+ - run: cargo check --locked
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index da4d076..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-language: rust
-
-rust:
- - 1.31.0
- - stable
- - beta
- - nightly
-
-script: cargo test
-
-matrix:
- include:
- - rust: nightly
- name: Minimal versions
- before_script:
- - cargo -Z minimal-versions generate-lockfile
- script:
- - cargo check --locked
diff --git a/Cargo.toml b/Cargo.toml
index f9d3ead..12ad9f0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
[package]
edition = "2018"
name = "paste"
-version = "0.1.10"
+version = "0.1.14"
authors = ["David Tolnay <dtolnay@gmail.com>"]
description = "Macros for all your token pasting needs"
readme = "README.md"
@@ -22,7 +22,7 @@
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
[dependencies.paste-impl]
-version = "=0.1.10"
+version = "=0.1.14"
[dependencies.proc-macro-hack]
version = "0.5.9"
@@ -31,5 +31,3 @@
[dev-dependencies.trybuild]
version = "1.0"
-[badges.travis-ci]
-repository = "dtolnay/paste"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 6f0d704..2d4833f 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "paste"
-version = "0.1.10"
+version = "0.1.14"
authors = ["David Tolnay <dtolnay@gmail.com>"]
edition = "2018"
license = "MIT OR Apache-2.0"
@@ -8,11 +8,8 @@
repository = "https://github.com/dtolnay/paste"
readme = "README.md"
-[badges]
-travis-ci = { repository = "dtolnay/paste" }
-
[dependencies]
-paste-impl = { version = "=0.1.10", path = "impl" }
+paste-impl = { version = "=0.1.14", path = "impl" }
proc-macro-hack = "0.5.9"
[dev-dependencies]
diff --git a/METADATA b/METADATA
index bf81f11..39fea39 100644
--- a/METADATA
+++ b/METADATA
@@ -9,11 +9,11 @@
type: GIT
value: "https://github.com/dtolnay/paste"
}
- version: "0.1.10"
+ version: "0.1.14"
license_type: NOTICE
last_upgrade_date {
year: 2020
- month: 4
- day: 17
+ month: 5
+ day: 25
}
}
diff --git a/README.md b/README.md
index 4204dbe..28fcafb 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
Macros for all your token pasting needs
=======================================
-[![Build Status](https://api.travis-ci.org/dtolnay/paste.svg?branch=master)](https://travis-ci.org/dtolnay/paste)
+[![Build Status](https://img.shields.io/github/workflow/status/dtolnay/paste/CI/master)](https://github.com/dtolnay/paste/actions?query=branch%3Amaster)
[![Latest Version](https://img.shields.io/crates/v/paste.svg)](https://crates.io/crates/paste)
[![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/paste)
@@ -126,8 +126,9 @@
segment to lower- or uppercase as part of the paste. For example, `[<ld_
$reg:lower _expr>]` would paste to `ld_bc_expr` if invoked with $reg=`Bc`.
-Use `$var:snake` to convert CamelCase input to snake\_case. These compose, so
-for example `$var:snake:upper` would give you SCREAMING\_CASE.
+Use `$var:snake` to convert CamelCase input to snake\_case.
+Use `$var:camel` to convert snake\_case to CamelCase.
+These compose, so for example `$var:snake:upper` would give you SCREAMING\_CASE.
The precise Unicode conversions are as defined by [`str::to_lowercase`] and
[`str::to_uppercase`].
diff --git a/src/lib.rs b/src/lib.rs
index 8125222..6d73ee3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -117,8 +117,9 @@
//! example, `[<ld_ $reg:lower _expr>]` would paste to `ld_bc_expr` if invoked
//! with $reg=`Bc`.
//!
-//! Use `$var:snake` to convert CamelCase input to snake\_case. These compose,
-//! so for example `$var:snake:upper` would give you SCREAMING\_CASE.
+//! Use `$var:snake` to convert CamelCase input to snake\_case.
+//! Use `$var:camel` to convert snake\_case to CamelCase.
+//! These compose, so for example `$var:snake:upper` would give you SCREAMING\_CASE.
//!
//! The precise Unicode conversions are as defined by [`str::to_lowercase`] and
//! [`str::to_uppercase`].
diff --git a/tests/test.rs b/tests/test.rs
index 435eb71..8e6ea75 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -172,6 +172,26 @@
}
}
+mod test_none_delimited_single_lifetime {
+ macro_rules! m {
+ ($life:lifetime) => {
+ paste::item! {
+ pub struct S;
+ impl<$life> S {
+ fn f() {}
+ }
+ }
+ };
+ }
+
+ m!('a);
+
+ #[test]
+ fn test() {
+ S::f();
+ }
+}
+
mod test_to_lower {
macro_rules! m {
($id:ident) => {
@@ -255,3 +275,92 @@
let _ = LIBPASTE;
}
}
+
+mod test_to_camel {
+ macro_rules! m {
+ ($id:ident) => {
+ paste::item! {
+ const DEFAULT_CAMEL: &str = stringify!([<$id:camel>]);
+ const LOWER_CAMEL: &str = stringify!([<$id:camel:lower>]);
+ const UPPER_CAMEL: &str = stringify!([<$id:camel:upper>]);
+ }
+ };
+ }
+
+ m!(this_is_but_a_test);
+
+ #[test]
+ fn test_to_camel() {
+ assert_eq!(DEFAULT_CAMEL, "ThisIsButATest");
+ assert_eq!(LOWER_CAMEL, "thisisbutatest");
+ assert_eq!(UPPER_CAMEL, "THISISBUTATEST");
+ }
+}
+
+#[test]
+fn test_env_to_camel() {
+ paste::expr! {
+ const [<LIB env!("CARGO_PKG_NAME"):camel>]: &str = "libpaste";
+
+ let _ = LIBPaste;
+ }
+}
+
+mod test_doc_expr {
+ // https://github.com/dtolnay/paste/issues/29
+
+ macro_rules! doc_expr {
+ ($doc:expr) => {
+ paste::item! {
+ #[doc = $doc]
+ pub struct S;
+ }
+ };
+ }
+
+ doc_expr!(stringify!());
+
+ #[test]
+ fn test_doc_expr() {
+ let _: S;
+ }
+}
+
+mod test_type_in_path {
+ // https://github.com/dtolnay/paste/issues/31
+
+ mod keys {
+ #[derive(Default)]
+ pub struct Mib<T = ()>(std::marker::PhantomData<T>);
+ }
+
+ macro_rules! types {
+ ($mib:ty) => {
+ paste::item! {
+ #[derive(Default)]
+ pub struct S(pub keys::$mib);
+ }
+ };
+ }
+
+ macro_rules! write {
+ ($fn:ident, $field:ty) => {
+ paste::item! {
+ pub fn $fn() -> $field {
+ $field::default()
+ }
+ }
+ };
+ }
+
+ types! {Mib<[usize; 2]>}
+ write! {get_a, keys::Mib}
+ write! {get_b, usize}
+
+ #[test]
+ fn test_type_in_path() {
+ let _: S;
+ let _ = get_a;
+ let _ = get_b;
+ }
+}