mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-08 22:28:01 -05:00
chore(ci): update tfhe-lints for newer compiler version
This commit is contained in:
committed by
Nicolas Sarlin
parent
52a1191474
commit
1f2e1537fa
@@ -10,10 +10,10 @@ crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "238edf273d195c8e472851ebd60571f77f978ac8" }
|
||||
dylint_linting = "3.2.1"
|
||||
dylint_linting = "4.0.0"
|
||||
|
||||
[dev-dependencies]
|
||||
dylint_testing = "3.2.1"
|
||||
dylint_testing = "4.0.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tfhe-versionable = "0.4.0"
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ impl SerializeWithoutVersionizeInner {
|
||||
self.versionize_trait
|
||||
.get_or_init(|| {
|
||||
let versionize_trait = cx.tcx.all_traits().find(|def_id| {
|
||||
cx.match_def_path(*def_id, symbols_list_from_str(&VERSIONIZE_TRAIT).as_slice())
|
||||
let path = cx.get_def_path(*def_id);
|
||||
path == symbols_list_from_str(&VERSIONIZE_TRAIT)
|
||||
});
|
||||
|
||||
versionize_trait
|
||||
@@ -85,8 +86,8 @@ impl<'tcx> LateLintPass<'tcx> for SerializeWithoutVersionize {
|
||||
|
||||
// Check if the implemented trait is `Serialize`
|
||||
if let Some(def_id) = trait_ref.trait_def_id() {
|
||||
if cx.match_def_path(def_id, symbols_list_from_str(&SERIALIZE_TRAIT).as_slice())
|
||||
{
|
||||
let path = cx.get_def_path(def_id);
|
||||
if path == symbols_list_from_str(&SERIALIZE_TRAIT) {
|
||||
// Try to find an implementation of versionize for this type
|
||||
let mut found_impl = false;
|
||||
if let Some(versionize_trait) = self.0.versionize_trait(cx) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use rustc_ast::tokenstream::TokenTree;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::AttrArgs;
|
||||
use rustc_lint::LateContext;
|
||||
use rustc_middle::ty::{Ty, TyKind};
|
||||
use rustc_span::Symbol;
|
||||
@@ -11,16 +12,19 @@ pub fn symbols_list_from_str(list: &[&str]) -> Vec<Symbol> {
|
||||
|
||||
/// Checks if the lint is allowed for the item represented by [`DefId`].
|
||||
/// This shouldn't be necessary since the lints are declared with the
|
||||
/// `declare_tool_lint` macro but for a mysterious reason this does not
|
||||
/// `impl_late_lint` macro but for a mysterious reason this does not
|
||||
/// work automatically.
|
||||
pub fn is_allowed_lint(cx: &LateContext<'_>, target: DefId, lint_name: &str) -> bool {
|
||||
for attr in cx.tcx.get_attrs(target, Symbol::intern("allow")) {
|
||||
let tokens = attr.get_normal_item().args.inner_tokens();
|
||||
let mut trees = tokens.trees();
|
||||
if let AttrArgs::Delimited(args) = &attr.get_normal_item().args {
|
||||
let len = args.tokens.len();
|
||||
|
||||
if let Some(TokenTree::Token(tool_token, _)) = trees.next() {
|
||||
if tool_token.is_ident_named(Symbol::intern(lint_name)) {
|
||||
return true;
|
||||
for id in 0..len {
|
||||
if let Some(TokenTree::Token(tool_token, _)) = args.tokens.get(id) {
|
||||
if tool_token.is_ident_named(Symbol::intern(lint_name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user