Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Rust 2021 edition #7

Merged
merged 2 commits into from
Mar 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "lombok"
version = "0.3.3"
description = "Lombok port for Rust"
authors = ["sokomishalov <sokomishalov@mail.ru>"]
edition = "2018"
edition = "2021"
readme = "README.md"
license = "MIT OR Apache-2.0"
repository = "https://github.com/sokomishalov/lombok-rs"
Expand Down
6 changes: 3 additions & 3 deletions src/equals_and_hash_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub(crate) fn equals_and_hash_code(input: TokenStream) -> TokenStream {
use std::hash::{Hash, Hasher};

impl #impl_generics #name #ty_generics #where_clause {
fn equals(&self, other: &#name#ty_generics) -> bool {
fn equals(&self, other: &#name #ty_generics) -> bool {
self.eq(&other)
}

Expand All @@ -74,7 +74,7 @@ pub(crate) fn equals_and_hash_code(input: TokenStream) -> TokenStream {
}

impl #impl_generics ::core::cmp::PartialEq for #name #ty_generics #where_clause {
fn eq(&self, other: &#name#ty_generics) -> bool {
fn eq(&self, other: &#name #ty_generics) -> bool {
match *other {
#name {
#(
Expand All @@ -94,7 +94,7 @@ pub(crate) fn equals_and_hash_code(input: TokenStream) -> TokenStream {
}
}

fn ne(&self, other: &TestNamedStructure#ty_generics) -> bool {
Copy link
Contributor Author

@jaudiger jaudiger Mar 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one was not intended. So I switched it to #name

fn ne(&self, other: &#name #ty_generics) -> bool {
match *other {
#name {
#(
Expand Down
1 change: 0 additions & 1 deletion src/to_string.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use proc_macro::TokenStream;


use quote::{format_ident, quote};

use crate::utils::syn::{named_fields, parse_derive_input};
Expand Down
4 changes: 2 additions & 2 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct TestNamedStructure<'a> {
age: u8,
nick: &'a str,
languages: Vec<String>,
hobby: Box<String>,
hobby: Box<&'a str>,
}

#[cfg(test)]
Expand All @@ -42,7 +42,7 @@ mod tests {
*default.get_age_mut() = 10;
*default.get_nick_mut() = "another";
*default.get_languages_mut() = vec!["python".to_string()];
*default.get_hobby_mut() = Box::new("tennis".to_string());
*default.get_hobby_mut() = Box::new("tennis");

let copy = TestNamedStructure::default();

Expand Down