| { | ||
| "git": { | ||
| "sha1": "4ffed377239acf07f5fbe2cfa152b0824790852b" | ||
| "sha1": "76f2101fb23808d25c90dcba10f24bcc2cc6986c" | ||
| }, | ||
| "path_in_vcs": "" | ||
| } |
@@ -8,2 +8,5 @@ name: CI | ||
| env: | ||
| RUSTFLAGS: '-Dwarnings' | ||
| jobs: | ||
@@ -25,7 +28,7 @@ test: | ||
| mintest: | ||
| name: Rust 1.34.0 | ||
| name: Rust 1.36.0 | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - uses: dtolnay/rust-toolchain@1.34.0 | ||
| - uses: dtolnay/rust-toolchain@1.36.0 | ||
| - run: cargo test --test test_item | ||
@@ -65,2 +68,3 @@ | ||
| - uses: actions/checkout@v2 | ||
| - uses: dtolnay/install@cargo-outdated | ||
| - run: cargo outdated --exit-code 1 |
+3
-1
@@ -16,3 +16,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO | ||
| name = "paste" | ||
| version = "1.0.6" | ||
| version = "1.0.7" | ||
| authors = ["David Tolnay <dtolnay@gmail.com>"] | ||
@@ -24,2 +24,3 @@ description = "Macros for all your token pasting needs" | ||
| repository = "https://github.com/dtolnay/paste" | ||
| [package.metadata.docs.rs] | ||
@@ -30,2 +31,3 @@ targets = ["x86_64-unknown-linux-gnu"] | ||
| proc-macro = true | ||
| [dev-dependencies.paste-test-suite] | ||
@@ -32,0 +34,0 @@ version = "0" |
+26
-6
@@ -142,2 +142,3 @@ //! [![github]](https://github.com/dtolnay/paste) [![crates-io]](https://crates.io/crates/paste) [![docs-rs]](https://docs.rs/paste) | ||
| clippy::doc_markdown, | ||
| clippy::match_same_arms, | ||
| clippy::module_name_repetitions, | ||
@@ -158,2 +159,3 @@ clippy::needless_doctest_main, | ||
| use proc_macro::{Delimiter, Group, Ident, Punct, Spacing, Span, TokenStream, TokenTree}; | ||
| use std::char; | ||
| use std::iter; | ||
@@ -368,10 +370,28 @@ use std::panic; | ||
| if let Segment::String(string) = segment { | ||
| if string.value.contains(&['#', '\\', '.', '+'][..]) { | ||
| if string.value.starts_with("'\\u{") { | ||
| let hex = &string.value[4..string.value.len() - 2]; | ||
| if let Ok(unsigned) = u32::from_str_radix(hex, 16) { | ||
| if let Some(ch) = char::from_u32(unsigned) { | ||
| string.value.clear(); | ||
| string.value.push(ch); | ||
| continue; | ||
| } | ||
| } | ||
| } | ||
| if string.value.contains(&['#', '\\', '.', '+'][..]) | ||
| || string.value.starts_with("b'") | ||
| || string.value.starts_with("b\"") | ||
| || string.value.starts_with("br\"") | ||
| { | ||
| return Err(Error::new(string.span, "unsupported literal")); | ||
| } | ||
| string.value = string | ||
| .value | ||
| .replace('"', "") | ||
| .replace('\'', "") | ||
| .replace('-', "_"); | ||
| let mut range = 0..string.value.len(); | ||
| if string.value.starts_with("r\"") { | ||
| range.start += 2; | ||
| range.end -= 1; | ||
| } else if string.value.starts_with(&['"', '\''][..]) { | ||
| range.start += 1; | ||
| range.end -= 1; | ||
| } | ||
| string.value = string.value[range].replace('-', "_"); | ||
| } | ||
@@ -378,0 +398,0 @@ } |
+13
-1
@@ -29,3 +29,3 @@ use paste::paste; | ||
| #[test] | ||
| fn test_integer() { | ||
| fn test_literals() { | ||
| const CONST0: &str = "const0"; | ||
@@ -35,2 +35,14 @@ | ||
| assert_eq!(pasted, CONST0); | ||
| let pasted = paste!([<CONST '0'>]); | ||
| assert_eq!(pasted, CONST0); | ||
| let pasted = paste!([<CONST "0">]); | ||
| assert_eq!(pasted, CONST0); | ||
| let pasted = paste!([<CONST r"0">]); | ||
| assert_eq!(pasted, CONST0); | ||
| let pasted = paste!([<CONST '\u{30}'>]); | ||
| assert_eq!(pasted, CONST0); | ||
| } | ||
@@ -37,0 +49,0 @@ |
@@ -7,2 +7,10 @@ use paste::paste; | ||
| paste! { | ||
| fn [<f '"'>]() {} | ||
| } | ||
| paste! { | ||
| fn [<f "'">]() {} | ||
| } | ||
| fn main() {} |
| use paste::paste; | ||
| paste! { | ||
| fn [<1e+100>]() {} | ||
| fn [<x 1e+100 z>]() {} | ||
| } | ||
| paste! { | ||
| // `xyz` is not correct. `xbyz` is certainly not correct. Maybe `x121z` | ||
| // would be justifiable but for now don't accept this. | ||
| fn [<x b'y' z>]() {} | ||
| } | ||
| paste! { | ||
| fn [<x b"y" z>]() {} | ||
| } | ||
| paste! { | ||
| fn [<x br"y" z>]() {} | ||
| } | ||
| fn main() {} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet