Skip to content

Commit a0682a0

Browse files
authored
Merge pull request #25 from alecmocatta/mute-warnings
Mute warnings
2 parents 1d5e4c3 + b429b6c commit a0682a0

File tree

6 files changed

+36
-23
lines changed

6 files changed

+36
-23
lines changed

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[package]
44
name = "serde_closure"
5-
version = "0.2.9"
5+
version = "0.2.10"
66
license = "MIT OR Apache-2.0"
77
authors = ["Alec Mocatta <[email protected]>"]
88
categories = ["development-tools","encoding","rust-patterns","network-programming"]
@@ -14,7 +14,7 @@ This library provides macros that wrap closures to make them serializable and de
1414
"""
1515
repository = "https://github.com/alecmocatta/serde_closure"
1616
homepage = "https://github.com/alecmocatta/serde_closure"
17-
documentation = "https://docs.rs/serde_closure/0.2.9"
17+
documentation = "https://docs.rs/serde_closure/0.2.10"
1818
readme = "README.md"
1919
edition = "2018"
2020

@@ -23,7 +23,7 @@ azure-devops = { project = "alecmocatta/serde_closure", pipeline = "tests" }
2323
maintenance = { status = "actively-developed" }
2424

2525
[dependencies]
26-
serde_closure_derive = { version = "=0.2.9", path = "serde_closure_derive" }
26+
serde_closure_derive = { version = "=0.2.10", path = "serde_closure_derive" }
2727
serde = { version = "1.0", features = ["derive"] }
2828
proc-macro-hack = "0.5"
2929

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![MIT / Apache 2.0 licensed](https://img.shields.io/crates/l/serde_closure.svg?maxAge=2592000)](#License)
55
[![Build Status](https://dev.azure.com/alecmocatta/serde_closure/_apis/build/status/tests?branchName=master)](https://dev.azure.com/alecmocatta/serde_closure/_build/latest?branchName=master)
66

7-
[Docs](https://docs.rs/serde_closure/0.2.9)
7+
[Docs](https://docs.rs/serde_closure/0.2.10)
88

99
Serializable and debuggable closures.
1010

@@ -30,9 +30,9 @@ requires nightly Rust for the `unboxed_closures` and `fn_traits` features (rust
3030
issue [#29625](https://github.com/rust-lang/rust/issues/29625)).
3131

3232
* There are three macros,
33-
[`FnOnce`](https://docs.rs/serde_closure/0.2.9/serde_closure/macro.FnOnce.html),
34-
[`FnMut`](https://docs.rs/serde_closure/0.2.9/serde_closure/macro.FnMut.html)
35-
and [`Fn`](https://docs.rs/serde_closure/0.2.9/serde_closure/macro.Fn.html),
33+
[`FnOnce`](https://docs.rs/serde_closure/0.2.10/serde_closure/macro.FnOnce.html),
34+
[`FnMut`](https://docs.rs/serde_closure/0.2.10/serde_closure/macro.FnMut.html)
35+
and [`Fn`](https://docs.rs/serde_closure/0.2.10/serde_closure/macro.Fn.html),
3636
corresponding to the three types of Rust closure.
3737
* Wrap your closure with one of the macros and it will now implement `Copy`,
3838
`Clone`, `PartialEq`, `Eq`, `Hash`, `PartialOrd`, `Ord`, `Serialize`,

azure-pipelines.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
rust_target_run: 'x86_64-pc-windows-msvc i686-pc-windows-msvc' # currently broken building crate-type=lib: x86_64-pc-windows-gnu i686-pc-windows-gnu
2727
mac:
2828
imageName: 'macos-10.13'
29-
rust_target_run: 'x86_64-apple-darwin i686-apple-darwin'
29+
rust_target_run: 'x86_64-apple-darwin'
3030
linux:
3131
imageName: 'ubuntu-16.04'
3232
rust_target_run: 'x86_64-unknown-linux-gnu i686-unknown-linux-gnu x86_64-unknown-linux-musl i686-unknown-linux-musl'

serde_closure_derive/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "serde_closure_derive"
3-
version = "0.2.9"
3+
version = "0.2.10"
44
license = "MIT OR Apache-2.0"
55
authors = ["Alec Mocatta <[email protected]>"]
66
categories = ["development-tools","encoding","rust-patterns","network-programming"]
@@ -14,7 +14,7 @@ See https://crates.io/crates/serde_closure for documentation.
1414
"""
1515
repository = "https://github.com/alecmocatta/serde_closure"
1616
homepage = "https://github.com/alecmocatta/serde_closure"
17-
documentation = "https://docs.rs/serde_closure/0.2.9"
17+
documentation = "https://docs.rs/serde_closure/0.2.10"
1818
edition = "2018"
1919

2020
[badges]

serde_closure_derive/src/lib.rs

+25-12
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//! See [`serde_closure`](https://docs.rs/serde_closure/) for
1010
//! documentation.
1111
12-
#![doc(html_root_url = "https://docs.rs/serde_closure_derive/0.2.9")]
12+
#![doc(html_root_url = "https://docs.rs/serde_closure_derive/0.2.10")]
1313
#![feature(proc_macro_diagnostic)]
1414
#![allow(non_snake_case)] // due to proc-macro-hack can't apply this directly
1515

@@ -261,6 +261,7 @@ fn impl_fn_once(closure: Closure, kind: Kind) -> Result<TokenStream, Error> {
261261
Ok(quote! {
262262
{
263263
mod #impls_name {
264+
#![allow(warnings)]
264265
use ::serde_closure::{
265266
internal::{self, is_phantom, to_phantom},
266267
structs,
@@ -420,12 +421,16 @@ fn impl_fn_once(closure: Closure, kind: Kind) -> Result<TokenStream, Error> {
420421
}
421422

422423
// This asserts that inferred env variables aren't nameable types.
424+
#[allow(warnings)]
423425
{
424426
#(let #env_variables = ::serde_closure::internal::a_variable;)*
425427
}
426428
// This asserts that inferred env variables aren't types with >=1 type parameters.
427-
if false {
428-
#(&#env_variables::<>;)*
429+
#[allow(warnings)]
430+
{
431+
if false {
432+
#(&#env_variables::<>;)*
433+
}
429434
}
430435
// TODO: Work out how to assert env variables aren't unnameable types with 0 type parameters.
431436
// This might work in the future, but today it causes borrowck issues:
@@ -442,19 +447,24 @@ fn impl_fn_once(closure: Closure, kind: Kind) -> Result<TokenStream, Error> {
442447

443448
let closure =
444449
#(#attrs)* #asyncness move |mut #env_name: #env_type, (#(#input_pats,)*): (#(#input_types,)*)| #output {
445-
if false {
446-
::serde_closure::internal::is_phantom(& #env_deref, #env_types_name);
450+
#[allow(warnings)]
451+
{
452+
if false {
453+
::serde_closure::internal::is_phantom(& #env_deref, #env_types_name);
454+
}
447455
}
448456
#env_deconstruct
449457
#body
450458
};
451459

452-
if false {
453-
#[allow(unreachable_code)]
454-
let _ = closure(#ret_ref, loop {});
455-
}
456-
if false {
457-
let ::serde_closure::internal::ZeroSizedAssertion = unsafe { ::serde_closure::internal::core::mem::transmute(closure) };
460+
#[allow(warnings)]
461+
{
462+
if false {
463+
let _ = closure(#ret_ref, loop {});
464+
}
465+
if false {
466+
let ::serde_closure::internal::ZeroSizedAssertion = unsafe { ::serde_closure::internal::core::mem::transmute(closure) };
467+
}
458468
}
459469

460470
::serde_closure::structs::#name::internal_new(#ret_name.with_f(closure))
@@ -580,7 +590,10 @@ impl<'a> State<'a> {
580590
let not_env_variables = take(self.not_env_variables).into_iter();
581591
let mut vec = Vec::with_capacity(2);
582592
if not_env_variables.len() != 0 {
583-
vec.push(parse2(quote! { { #(use #not_env_variables;)* } }).unwrap());
593+
vec.push(
594+
parse2(quote! { #[allow(warnings)] { #(use #not_env_variables;)* } })
595+
.unwrap(),
596+
);
584597
}
585598
vec.push(stmt);
586599
vec

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
//! automatically serializable and deserializable with
165165
//! [`serde`](https://github.com/serde-rs/serde).
166166
167-
#![doc(html_root_url = "https://docs.rs/serde_closure/0.2.9")]
167+
#![doc(html_root_url = "https://docs.rs/serde_closure/0.2.10")]
168168
#![feature(unboxed_closures, fn_traits)]
169169
#![warn(
170170
missing_copy_implementations,

0 commit comments

Comments
 (0)