Skip to content

Commit

Permalink
Fix warnings on nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexagon committed Jul 18, 2024
1 parent db13175 commit 3b12e2c
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "tl-proto"
description = "A collection of traits for working with TL serialization/deserialization"
authors = ["Ivan Kalinin <i.kalinin@dexpa.io>"]
repository = "https://github.com/broxus/tl-proto"
version = "0.4.6"
version = "0.4.7"
edition = "2021"
include = ["src/**/*.rs", "README.md"]
license = "MIT"
Expand All @@ -18,7 +18,7 @@ sha2 = { version = "0.10", optional = true }
smallvec = { version = "1.7", features = ["union", "const_generics"] }
thiserror = "1.0"

tl-proto-proc = { version = "=0.4.6", path = "proc", optional = true }
tl-proto-proc = { version = "=0.4.7", path = "proc", optional = true }

[features]
default = ["derive", "bytes", "hash"]
Expand Down
2 changes: 1 addition & 1 deletion proc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "tl-proto-proc"
description = "A collection of traits for working with TL serialization/deserialization"
authors = ["Ivan Kalinin <i.kalinin@dexpa.io>"]
repository = "https://github.com/broxus/tl-proto"
version = "0.4.6"
version = "0.4.7"
edition = "2021"
include = ["src/**/*.rs", "../README.md"]
license = "MIT"
Expand Down
18 changes: 2 additions & 16 deletions proc/src/dummy.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
pub fn wrap_in_const(
trait_: &str,
ty: &syn::Ident,
code: proc_macro2::TokenStream,
) -> proc_macro2::TokenStream {
let dummy_const = if cfg!(underscore_consts) {
quote::format_ident!("_")
} else {
quote::format_ident!("_IMPL_{}_FOR_{}", trait_, unraw(ty))
};

pub fn wrap_in_const(code: proc_macro2::TokenStream) -> proc_macro2::TokenStream {
let use_tl_proto = quote::quote! {
#[allow(rust_2018_idioms, clippy::useless_attribute)]
extern crate tl_proto as _tl_proto;
Expand All @@ -17,13 +7,9 @@ pub fn wrap_in_const(
quote::quote! {
#[doc(hidden)]
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
const #dummy_const: () = {
const _: () = {
#use_tl_proto
#code
};
}
}

pub fn unraw(ident: &syn::Ident) -> String {
ident.to_string().trim_start_matches("r#").to_owned()
}
2 changes: 1 addition & 1 deletion proc/src/tl_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub fn impl_derive_tl_read(input: syn::DeriveInput) -> Result<TokenStream, Vec<s
}
};

Ok(dummy::wrap_in_const("TL_READ", ident, result))
Ok(dummy::wrap_in_const(result))
}

fn build_generics(container: &ast::Container) -> syn::Generics {
Expand Down
2 changes: 1 addition & 1 deletion proc/src/tl_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub fn impl_derive_tl_write(input: syn::DeriveInput) -> Result<TokenStream, Vec<
}
};

Ok(dummy::wrap_in_const("TL_WRITE", ident, result))
Ok(dummy::wrap_in_const(result))
}

fn build_generics(container: &ast::Container) -> syn::Generics {
Expand Down
6 changes: 3 additions & 3 deletions scheme/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name = "tl-scheme"
description = "TL language grammar"
authors = ["Ivan Kalinin <i.kalinin@dexpa.io>"]
repository = "https://github.com/broxus/tl-proto"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
include = ["src/**/*.rs", "src/tl.pest", "README.md"]
license = "MIT"

[dependencies]
crc = "3"
pest = "2.1"
pest_derive = "2.1"
pest = "2.7"
pest_derive = "2.7"
rustc-hash = "1.1.0"
thiserror = "1.0"

0 comments on commit 3b12e2c

Please sign in to comment.