Skip to content

Commit

Permalink
Auto merge of #16518 - tetsuharuohzeki:enable-some-minor-lints, r=Vey…
Browse files Browse the repository at this point in the history
…kril

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
  • Loading branch information
bors committed Feb 9, 2024
2 parents 65a6441 + 1e4171b commit cdc3e83
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 12 deletions.
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-def/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}

Expand Down
2 changes: 1 addition & 1 deletion crates/hir-def/src/item_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {}
Expand Down
4 changes: 2 additions & 2 deletions crates/hir-def/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/hir-expand/src/ast_id_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-expand/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion crates/hir/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion crates/syntax/src/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/la-arena/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}

Expand Down

0 comments on commit cdc3e83

Please sign in to comment.