Skip to content

Commit 618d8fe

Browse files
committed
v0.1.13 release
1 parent a23675f commit 618d8fe

7 files changed

Lines changed: 35 additions & 35 deletions

File tree

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
- name: test stable --release
1717
run: cargo +stable test --release --verbose
1818
# MSRV
19-
- uses: dtolnay/rust-toolchain@1.63.0
19+
- uses: dtolnay/rust-toolchain@1.65.0
2020
- name: build MSRV
21-
run: cargo +1.63.0 build --verbose
21+
run: cargo +1.65.0 build --verbose
2222
- name: test MSRV
23-
run: cargo +1.63.0 test --verbose
23+
run: cargo +1.65.0 test --verbose
2424
- name: test MSRV --release
25-
run: cargo +1.63.0 test --release --verbose
25+
run: cargo +1.65.0 test --release --verbose

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGELOG
22

3+
## v0.1.13
4+
* Add support methods that return Self as part of a tuple
5+
* [test](/tests/return_self_tuple.rs)
6+
* Bumped MSRV to 1.65
7+
38
## v0.1.12
49
* Fix warnings about elided lifetimes already named in generated code
510

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "faux"
3-
version = "0.1.12"
3+
version = "0.1.13"
44
authors = ["Andres <andresnrx@gmail.com>"]
55
license = "MIT"
66
description = "A library to mock structs"
@@ -9,10 +9,10 @@ repository = "https://github.com/nrxus/faux"
99
edition = "2021"
1010
keywords = ["mock", "mocking", "test", "testing", "faux"]
1111
readme = "README.md"
12-
rust-version = "1.63"
12+
rust-version = "1.65"
1313

1414
[dependencies]
15-
faux_macros = { path = "faux_macros", version = "0.1.12" }
15+
faux_macros = { path = "faux_macros", version = "0.1.13" }
1616
paste = "1.0.4"
1717

1818
[dev-dependencies]

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# faux &emsp; [![Latest Version]][crates.io] [![rustc 1.63+]][Rust 1.63] [![docs]][api docs] ![][build]
1+
# faux &emsp; [![Latest Version]][crates.io] [![rustc 1.65+]][Rust 1.65] [![docs]][api docs] ![][build]
22

33
A library to create [mocks] out of structs.
44

@@ -227,8 +227,8 @@ methods in structs.
227227

228228
[Latest Version]: https://img.shields.io/crates/v/faux.svg
229229
[crates.io]: https://crates.io/crates/faux
230-
[rustc 1.63+]: https://img.shields.io/badge/rustc-1.63+-blue.svg
231-
[Rust 1.63]: https://blog.rust-lang.org/2022/08/11/Rust-1.63.0.html
230+
[rustc 1.65+]: https://img.shields.io/badge/rustc-1.65+-blue.svg
231+
[Rust 1.65]: https://blog.rust-lang.org/2022/11/03/Rust-1.65.0/
232232
[Latest Version]: https://img.shields.io/crates/v/faux.svg
233233
[docs]: https://img.shields.io/badge/api-docs-blue.svg
234234
[api docs]: https://docs.rs/faux/

faux_macros/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
[package]
22
name = "faux_macros"
3-
version = "0.1.12"
3+
version = "0.1.13"
44
authors = ["Andres <andresnrx@gmail.com>"]
55
edition = "2021"
66
license = "MIT"
77
description = "Implementations for #[create], #[methods], when!"
88
homepage = "https://github.com/nrxus/faux"
99
repository = "https://github.com/nrxus/faux"
1010
keywords = ["mock", "mocking", "test", "testing", "faux"]
11-
rust-version = "1.63"
11+
rust-version = "1.65"
1212

1313
[dependencies]
1414
syn = { version = "2", features = ["full", "extra-traits"] }
1515
quote = "1"
1616
proc-macro2 = "1"
17-
darling = "0.20"
17+
darling = "0.21"
1818
uuid = { version = "1", features = ["v4"] }
1919

2020
[dev-dependencies]

faux_macros/src/methods/morphed.rs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ impl<'a> Signature<'a> {
182182
}
183183

184184
if let Some(output) = self.output {
185-
if let Some(wrapped_self) = Self::wrap_self(output, morphed_ty, real_self, &proxy_real)? {
185+
if let Some(wrapped_self) = Self::wrap_self(output, morphed_ty, real_self, &proxy_real)?
186+
{
186187
proxy_real = wrapped_self;
187188
}
188189
}
@@ -275,7 +276,7 @@ impl<'a> Signature<'a> {
275276
syn::Type::Path(output) => output,
276277
syn::Type::Tuple(tuple) => {
277278
return Self::wrap_self_tuple(block, tuple, morphed_ty, real_self);
278-
},
279+
}
279280
output => return Err(unhandled_self_return(output)),
280281
};
281282

@@ -344,11 +345,13 @@ impl<'a> Signature<'a> {
344345
}
345346

346347
fn wrap_self_tuple(
347-
block: &TokenStream,
348-
tuple: &syn::TypeTuple,
348+
block: &TokenStream,
349+
tuple: &syn::TypeTuple,
349350
morphed_ty: &syn::TypePath,
350-
real_self: SelfType) -> darling::Result<Option<TokenStream>> {
351-
let elements = tuple.elems
351+
real_self: SelfType,
352+
) -> darling::Result<Option<TokenStream>> {
353+
let elements = tuple
354+
.elems
352355
.iter()
353356
.enumerate()
354357
.map(|e| {
@@ -361,10 +364,10 @@ impl<'a> Signature<'a> {
361364
Ok(wrapped.unwrap_or(tuple_index))
362365
})
363366
.collect::<darling::Result<Vec<TokenStream>>>()?;
364-
365-
Ok(Some(quote! {{
367+
368+
Ok(Some(quote! {{
366369
let tuple = #block;
367-
370+
368371
(# ( #elements),*)
369372
}}))
370373
}
@@ -464,11 +467,8 @@ fn add_lifetime(t: &mut Type, new_lifetime: &Lifetime) {
464467
..
465468
}) = segments.last_mut()
466469
{
467-
if let Some(first_arg) = args.args.first_mut() {
468-
match first_arg {
469-
GenericArgument::Type(t) => add_lifetime(t, new_lifetime),
470-
_ => {}
471-
}
470+
if let Some(GenericArgument::Type(t)) = args.args.first_mut() {
471+
add_lifetime(t, new_lifetime)
472472
}
473473
};
474474
}
@@ -522,10 +522,8 @@ fn ang_generic_contains_self(args: &syn::AngleBracketedGenericArguments, path: &
522522
if contains_self(&assoc.ty, path) {
523523
return true;
524524
}
525-
// TODO: use let-else once we bump MSRV to 1.65.0
526-
let args = match &assoc.generics {
527-
Some(args) => args,
528-
None => return false,
525+
let Some(args) = &assoc.generics else {
526+
return false;
529527
};
530528
ang_generic_contains_self(args, path)
531529
}

tests/return_self_tuple.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
use std::sync::Arc;
2-
use std::rc::Rc;
3-
use std::result::Result;
4-
use std::error::Error;
1+
use std::{error::Error, rc::Rc, result::Result, sync::Arc};
52

63
#[faux::create]
74
pub struct Foo;

0 commit comments

Comments
 (0)