Auto merge of #16518 - tetsuharuohzeki:enable-some-minor-lints, r=Veykril
Enable some minor lints that we should tackles This enables these lint rules that are commented as we should tackle at some points. - non_canonical_clone_impl - non_canonical_partial_ord_impl - self_named_constructors
This commit is contained in:
commit
cdc3e83c2c
@ -172,9 +172,6 @@ borrowed_box = "allow"
|
||||
derived_hash_with_manual_eq = "allow"
|
||||
forget_non_drop = "allow"
|
||||
needless_doctest_main = "allow"
|
||||
non_canonical_clone_impl = "allow"
|
||||
non_canonical_partial_ord_impl = "allow"
|
||||
self_named_constructors = "allow"
|
||||
too_many_arguments = "allow"
|
||||
type_complexity = "allow"
|
||||
wrong_self_convention = "allow"
|
||||
|
@ -317,7 +317,7 @@ fn parse_comma_sep<S>(subtree: &tt::Subtree<S>) -> Vec<SmolStr> {
|
||||
}
|
||||
|
||||
impl AttrsWithOwner {
|
||||
pub fn attrs_with_owner(db: &dyn DefDatabase, owner: AttrDefId) -> Self {
|
||||
pub fn new(db: &dyn DefDatabase, owner: AttrDefId) -> Self {
|
||||
Self { attrs: db.attrs(owner), owner }
|
||||
}
|
||||
|
||||
|
@ -372,7 +372,7 @@ impl<N> FileItemTreeId<N> {
|
||||
|
||||
impl<N> Clone for FileItemTreeId<N> {
|
||||
fn clone(&self) -> Self {
|
||||
Self(self.0)
|
||||
*self
|
||||
}
|
||||
}
|
||||
impl<N> Copy for FileItemTreeId<N> {}
|
||||
|
@ -219,7 +219,7 @@ pub struct ItemLoc<N: ItemTreeModItemNode> {
|
||||
|
||||
impl<N: ItemTreeModItemNode> Clone for ItemLoc<N> {
|
||||
fn clone(&self) -> Self {
|
||||
Self { container: self.container, id: self.id }
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
||||
@ -248,7 +248,7 @@ pub struct AssocItemLoc<N: ItemTreeModItemNode> {
|
||||
|
||||
impl<N: ItemTreeModItemNode> Clone for AssocItemLoc<N> {
|
||||
fn clone(&self) -> Self {
|
||||
Self { container: self.container, id: self.id }
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ impl PartialEq for AstIdMap {
|
||||
impl Eq for AstIdMap {}
|
||||
|
||||
impl AstIdMap {
|
||||
pub(crate) fn ast_id_map(
|
||||
pub(crate) fn new(
|
||||
db: &dyn ExpandDatabase,
|
||||
file_id: span::HirFileId,
|
||||
) -> triomphe::Arc<AstIdMap> {
|
||||
|
@ -61,7 +61,7 @@ pub trait ExpandDatabase: SourceDatabase {
|
||||
#[salsa::input]
|
||||
fn proc_macros(&self) -> Arc<ProcMacros>;
|
||||
|
||||
#[salsa::invoke(AstIdMap::ast_id_map)]
|
||||
#[salsa::invoke(AstIdMap::new)]
|
||||
fn ast_id_map(&self, file_id: HirFileId) -> Arc<AstIdMap>;
|
||||
|
||||
/// Main public API -- parses a hir file, not caring whether it's a real
|
||||
|
@ -30,7 +30,7 @@ macro_rules! impl_has_attrs {
|
||||
impl HasAttrs for $def {
|
||||
fn attrs(self, db: &dyn HirDatabase) -> AttrsWithOwner {
|
||||
let def = AttrDefId::$def_id(self.into());
|
||||
AttrsWithOwner::attrs_with_owner(db.upcast(), def)
|
||||
AttrsWithOwner::new(db.upcast(), def)
|
||||
}
|
||||
fn attr_id(self) -> AttrDefId {
|
||||
AttrDefId::$def_id(self.into())
|
||||
|
@ -36,7 +36,7 @@ impl<N: AstNode + std::fmt::Debug> std::fmt::Debug for AstPtr<N> {
|
||||
impl<N: AstNode> Copy for AstPtr<N> {}
|
||||
impl<N: AstNode> Clone for AstPtr<N> {
|
||||
fn clone(&self) -> AstPtr<N> {
|
||||
AstPtr { raw: self.raw, _ty: PhantomData }
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ impl<T> Ord for Idx<T> {
|
||||
|
||||
impl<T> PartialOrd for Idx<T> {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
|
||||
self.raw.partial_cmp(&other.raw)
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user