Skip to content

Commit cdc3e83

Browse files
committed
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
2 parents 65a6441 + 1e4171b commit cdc3e83

File tree

9 files changed

+9
-12
lines changed

9 files changed

+9
-12
lines changed

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ borrowed_box = "allow"
172172
derived_hash_with_manual_eq = "allow"
173173
forget_non_drop = "allow"
174174
needless_doctest_main = "allow"
175-
non_canonical_clone_impl = "allow"
176-
non_canonical_partial_ord_impl = "allow"
177-
self_named_constructors = "allow"
178175
too_many_arguments = "allow"
179176
type_complexity = "allow"
180177
wrong_self_convention = "allow"

crates/hir-def/src/attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ fn parse_comma_sep<S>(subtree: &tt::Subtree<S>) -> Vec<SmolStr> {
317317
}
318318

319319
impl AttrsWithOwner {
320-
pub fn attrs_with_owner(db: &dyn DefDatabase, owner: AttrDefId) -> Self {
320+
pub fn new(db: &dyn DefDatabase, owner: AttrDefId) -> Self {
321321
Self { attrs: db.attrs(owner), owner }
322322
}
323323

crates/hir-def/src/item_tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ impl<N> FileItemTreeId<N> {
372372

373373
impl<N> Clone for FileItemTreeId<N> {
374374
fn clone(&self) -> Self {
375-
Self(self.0)
375+
*self
376376
}
377377
}
378378
impl<N> Copy for FileItemTreeId<N> {}

crates/hir-def/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ pub struct ItemLoc<N: ItemTreeModItemNode> {
219219

220220
impl<N: ItemTreeModItemNode> Clone for ItemLoc<N> {
221221
fn clone(&self) -> Self {
222-
Self { container: self.container, id: self.id }
222+
*self
223223
}
224224
}
225225

@@ -248,7 +248,7 @@ pub struct AssocItemLoc<N: ItemTreeModItemNode> {
248248

249249
impl<N: ItemTreeModItemNode> Clone for AssocItemLoc<N> {
250250
fn clone(&self) -> Self {
251-
Self { container: self.container, id: self.id }
251+
*self
252252
}
253253
}
254254

crates/hir-expand/src/ast_id_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl PartialEq for AstIdMap {
155155
impl Eq for AstIdMap {}
156156

157157
impl AstIdMap {
158-
pub(crate) fn ast_id_map(
158+
pub(crate) fn new(
159159
db: &dyn ExpandDatabase,
160160
file_id: span::HirFileId,
161161
) -> triomphe::Arc<AstIdMap> {

crates/hir-expand/src/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub trait ExpandDatabase: SourceDatabase {
6161
#[salsa::input]
6262
fn proc_macros(&self) -> Arc<ProcMacros>;
6363

64-
#[salsa::invoke(AstIdMap::ast_id_map)]
64+
#[salsa::invoke(AstIdMap::new)]
6565
fn ast_id_map(&self, file_id: HirFileId) -> Arc<AstIdMap>;
6666

6767
/// Main public API -- parses a hir file, not caring whether it's a real

crates/hir/src/attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ macro_rules! impl_has_attrs {
3030
impl HasAttrs for $def {
3131
fn attrs(self, db: &dyn HirDatabase) -> AttrsWithOwner {
3232
let def = AttrDefId::$def_id(self.into());
33-
AttrsWithOwner::attrs_with_owner(db.upcast(), def)
33+
AttrsWithOwner::new(db.upcast(), def)
3434
}
3535
fn attr_id(self) -> AttrDefId {
3636
AttrDefId::$def_id(self.into())

crates/syntax/src/ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<N: AstNode + std::fmt::Debug> std::fmt::Debug for AstPtr<N> {
3636
impl<N: AstNode> Copy for AstPtr<N> {}
3737
impl<N: AstNode> Clone for AstPtr<N> {
3838
fn clone(&self) -> AstPtr<N> {
39-
AstPtr { raw: self.raw, _ty: PhantomData }
39+
*self
4040
}
4141
}
4242

lib/la-arena/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl<T> Ord for Idx<T> {
7070

7171
impl<T> PartialOrd for Idx<T> {
7272
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
73-
self.raw.partial_cmp(&other.raw)
73+
Some(self.cmp(other))
7474
}
7575
}
7676

0 commit comments

Comments
 (0)