summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChih-Hung Hsieh <chh@google.com>2020-04-17 14:32:19 -0700
committerChih-Hung Hsieh <chh@google.com>2020-04-17 14:56:33 -0700
commit19811483df3157e4b67243eb121c0d98cf20a239 (patch)
tree1b8c1d3f08ca59b539a341125610c6af7e70fa9a
parenta1b325846b1eb3f6de63cf424d5399faf83693bd (diff)
downloadpaste-impl-19811483df3157e4b67243eb121c0d98cf20a239.tar.gz
Add OWNERS; upgrade to 0.1.10
Test: make Change-Id: I146d751b4d95f3f8c1cc0309075c675f3d0d0697
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Cargo.toml2
-rw-r--r--Cargo.toml.orig2
-rw-r--r--METADATA12
-rw-r--r--OWNERS1
-rw-r--r--src/lib.rs13
6 files changed, 24 insertions, 8 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 984f7e4..28d7b30 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
{
"git": {
- "sha1": "68b6baab911f1fdf9d3ab1d3b3ab08b73b28d21a"
+ "sha1": "5feb37605c9ec2d237651dbd669e3527566a839e"
}
}
diff --git a/Cargo.toml b/Cargo.toml
index 91725d4..90aff3f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
[package]
edition = "2018"
name = "paste-impl"
-version = "0.1.8"
+version = "0.1.10"
authors = ["David Tolnay <dtolnay@gmail.com>"]
description = "Implementation detail of the `paste` crate"
license = "MIT OR Apache-2.0"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 8082791..9b7a04e 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "paste-impl"
-version = "0.1.8"
+version = "0.1.10"
authors = ["David Tolnay <dtolnay@gmail.com>"]
edition = "2018"
license = "MIT OR Apache-2.0"
diff --git a/METADATA b/METADATA
index c28d4fe..e289934 100644
--- a/METADATA
+++ b/METADATA
@@ -1,7 +1,5 @@
name: "paste-impl"
-description:
- "Implementation detail of the `paste` crate"
-
+description: "Implementation detail of the `paste` crate"
third_party {
url {
type: HOMEPAGE
@@ -11,7 +9,11 @@ third_party {
type: GIT
value: "https://github.com/dtolnay/paste"
}
- version: "0.1.8"
- last_upgrade_date { year: 2020 month: 3 day: 19 }
+ version: "0.1.10"
license_type: NOTICE
+ last_upgrade_date {
+ year: 2020
+ month: 4
+ day: 17
+ }
}
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..46fc303
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1 @@
+include platform/prebuilts/rust:/OWNERS
diff --git a/src/lib.rs b/src/lib.rs
index 97190d6..b2c1e41 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -181,6 +181,19 @@ fn paste_segments(span: Span, segments: &[Segment]) -> Result<TokenStream> {
};
if ident == "lower" {
evaluated.push(last.to_lowercase());
+ } else if ident == "upper" {
+ evaluated.push(last.to_uppercase());
+ } else if ident == "snake" {
+ let mut acc = String::new();
+ let mut prev = '_';
+ for ch in last.chars() {
+ if ch.is_uppercase() && prev != '_' {
+ acc.push('_');
+ }
+ acc.push(ch);
+ prev = ch;
+ }
+ evaluated.push(acc.to_lowercase());
} else {
return Err(Error::new_spanned(span, "unsupported modifier"));
}