Skip to content

Commit e341e99

Browse files
committed
Clippy-fix explicit auto-deref
Seems like these can be safely fixed. With one, I was particularly surprised -- `Some(pats) => &**pats,` in body.rs? ``` cargo clippy --fix -- -A clippy::all -D clippy::explicit_auto_deref ```
1 parent f1785f7 commit e341e99

File tree

20 files changed

+22
-22
lines changed

20 files changed

+22
-22
lines changed

crates/base-db/src/input.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl fmt::Display for CrateName {
128128
impl ops::Deref for CrateName {
129129
type Target = str;
130130
fn deref(&self) -> &str {
131-
&*self.0
131+
&self.0
132132
}
133133
}
134134

@@ -211,7 +211,7 @@ impl fmt::Display for CrateDisplayName {
211211
impl ops::Deref for CrateDisplayName {
212212
type Target = str;
213213
fn deref(&self) -> &str {
214-
&*self.crate_name
214+
&self.crate_name
215215
}
216216
}
217217

crates/base-db/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub trait SourceDatabase: FileLoader + std::fmt::Debug {
7777
fn parse_query(db: &dyn SourceDatabase, file_id: FileId) -> Parse<ast::SourceFile> {
7878
let _p = profile::span("parse_query").detail(|| format!("{:?}", file_id));
7979
let text = db.file_text(file_id);
80-
SourceFile::parse(&*text)
80+
SourceFile::parse(&text)
8181
}
8282

8383
/// We don't want to give HIR knowledge of source roots, hence we extract these

crates/hir-def/src/body.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ impl Body {
372372
/// Retrieves all ident patterns this pattern shares the ident with.
373373
pub fn ident_patterns_for<'slf>(&'slf self, pat: &'slf PatId) -> &'slf [PatId] {
374374
match self.or_pats.get(pat) {
375-
Some(pats) => &**pats,
375+
Some(pats) => pats,
376376
None => std::slice::from_ref(pat),
377377
}
378378
}

crates/hir-def/src/body/scope.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub struct ScopeData {
4747
impl ExprScopes {
4848
pub(crate) fn expr_scopes_query(db: &dyn DefDatabase, def: DefWithBodyId) -> Arc<ExprScopes> {
4949
let body = db.body(def);
50-
let mut scopes = ExprScopes::new(&*body);
50+
let mut scopes = ExprScopes::new(&body);
5151
scopes.shrink_to_fit();
5252
Arc::new(scopes)
5353
}

crates/hir/src/semantics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,7 @@ impl<'db> SemanticsImpl<'db> {
12461246

12471247
fn with_ctx<F: FnOnce(&mut SourceToDefCtx<'_, '_>) -> T, T>(&self, f: F) -> T {
12481248
let mut cache = self.s2d_cache.borrow_mut();
1249-
let mut ctx = SourceToDefCtx { db: self.db, cache: &mut *cache };
1249+
let mut ctx = SourceToDefCtx { db: self.db, cache: &mut cache };
12501250
f(&mut ctx)
12511251
}
12521252

crates/ide-assists/src/handlers/inline_call.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ fn inline(
394394
// Inline parameter expressions or generate `let` statements depending on whether inlining works or not.
395395
for ((pat, param_ty, _), usages, expr) in izip!(params, param_use_nodes, arguments).rev() {
396396
// izip confuses RA due to our lack of hygiene info currently losing us type info causing incorrect errors
397-
let usages: &[ast::PathExpr] = &*usages;
397+
let usages: &[ast::PathExpr] = &usages;
398398
let expr: &ast::Expr = expr;
399399

400400
let insert_let_stmt = || {

crates/ide-db/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ pub trait LineIndexDatabase: base_db::SourceDatabase {
165165

166166
fn line_index(db: &dyn LineIndexDatabase, file_id: FileId) -> Arc<LineIndex> {
167167
let text = db.file_text(file_id);
168-
Arc::new(LineIndex::new(&*text))
168+
Arc::new(LineIndex::new(&text))
169169
}
170170

171171
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]

crates/ide-diagnostics/src/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pub(crate) fn check_diagnostics_with_config(config: DiagnosticsConfig, ra_fixtur
102102
for file_id in files {
103103
let diagnostics = super::diagnostics(&db, &config, &AssistResolveStrategy::All, file_id);
104104

105-
let expected = extract_annotations(&*db.file_text(file_id));
105+
let expected = extract_annotations(&db.file_text(file_id));
106106
let mut actual = diagnostics
107107
.into_iter()
108108
.map(|d| {

crates/ide/src/inlay_hints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ mod tests {
459459
#[track_caller]
460460
pub(super) fn check_with_config(config: InlayHintsConfig, ra_fixture: &str) {
461461
let (analysis, file_id) = fixture::file(ra_fixture);
462-
let mut expected = extract_annotations(&*analysis.file_text(file_id).unwrap());
462+
let mut expected = extract_annotations(&analysis.file_text(file_id).unwrap());
463463
let inlay_hints = analysis.inlay_hints(&config, file_id, None).unwrap();
464464
let actual = inlay_hints
465465
.into_iter()

crates/ide/src/inlay_hints/bind_pat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ fn main() {
463463
}
464464
"#;
465465
let (analysis, file_id) = fixture::file(fixture);
466-
let expected = extract_annotations(&*analysis.file_text(file_id).unwrap());
466+
let expected = extract_annotations(&analysis.file_text(file_id).unwrap());
467467
let inlay_hints = analysis
468468
.inlay_hints(
469469
&InlayHintsConfig { type_hints: true, ..DISABLED_CONFIG },

0 commit comments

Comments
 (0)