Skip to content

Commit 28bab68

Browse files
committed
Auto merge of #12826 - fasterthanlime:in-tree-warnings, r=Veykril
Enable (and fix) extra lint groups required for in-tree build This enables 3 lint groups that are required to build rust-analyzer as an "in-tree" (git subtree) tool in `rust-lang/rust`, and fixes all relevant diagnostics. This change is tracked in: * #12818 Maintainer impact: more warnings, should be easy enough to fix them (it's mostly looking out for "rust-2015-isms", the lint group is poorly named). If you forget some, they'll show up during a `ra=>rust` sync.
2 parents 0ded8e7 + 7e285e1 commit 28bab68

File tree

262 files changed

+1125
-896
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

262 files changed

+1125
-896
lines changed

crates/base-db/src/change.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub struct Change {
1717
}
1818

1919
impl fmt::Debug for Change {
20-
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
20+
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
2121
let mut d = fmt.debug_struct("Change");
2222
if let Some(roots) = &self.roots {
2323
d.field("roots", roots);

crates/base-db/src/input.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl CrateName {
104104
}
105105

106106
impl fmt::Display for CrateName {
107-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
107+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
108108
self.0.fmt(f)
109109
}
110110
}
@@ -187,7 +187,7 @@ impl From<CrateName> for CrateDisplayName {
187187
}
188188

189189
impl fmt::Display for CrateDisplayName {
190-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
190+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
191191
self.crate_name.fmt(f)
192192
}
193193
}

crates/base-db/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
//! base_db defines basic database traits. The concrete DB is defined by ide.
2+
3+
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
4+
25
mod input;
36
mod change;
47
pub mod fixture;
@@ -54,7 +57,7 @@ pub const DEFAULT_LRU_CAP: usize = 128;
5457
pub trait FileLoader {
5558
/// Text of the file.
5659
fn file_text(&self, file_id: FileId) -> Arc<String>;
57-
fn resolve_path(&self, path: AnchoredPath) -> Option<FileId>;
60+
fn resolve_path(&self, path: AnchoredPath<'_>) -> Option<FileId>;
5861
fn relevant_crates(&self, file_id: FileId) -> Arc<FxHashSet<CrateId>>;
5962
}
6063

@@ -113,7 +116,7 @@ impl<T: SourceDatabaseExt> FileLoader for FileLoaderDelegate<&'_ T> {
113116
fn file_text(&self, file_id: FileId) -> Arc<String> {
114117
SourceDatabaseExt::file_text(self.0, file_id)
115118
}
116-
fn resolve_path(&self, path: AnchoredPath) -> Option<FileId> {
119+
fn resolve_path(&self, path: AnchoredPath<'_>) -> Option<FileId> {
117120
// FIXME: this *somehow* should be platform agnostic...
118121
let source_root = self.0.file_source_root(path.anchor);
119122
let source_root = self.0.source_root(source_root);

crates/cfg/src/cfg_expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl CfgExpr {
8585
}
8686
}
8787

88-
fn next_cfg_expr(it: &mut SliceIter<tt::TokenTree>) -> Option<CfgExpr> {
88+
fn next_cfg_expr(it: &mut SliceIter<'_, tt::TokenTree>) -> Option<CfgExpr> {
8989
let name = match it.next() {
9090
None => return None,
9191
Some(tt::TokenTree::Leaf(tt::Leaf::Ident(ident))) => ident.text.clone(),

crates/cfg/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! cfg defines conditional compiling options, `cfg` attribute parser and evaluator
22
3+
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
4+
35
mod cfg_expr;
46
mod dnf;
57
#[cfg(test)]

crates/flycheck/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
//! another compatible command (f.x. clippy) in a background thread and provide
33
//! LSP diagnostics based on the output of the command.
44
5+
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
6+
57
use std::{
68
fmt, io,
79
process::{ChildStderr, ChildStdout, Command, Stdio},

crates/hir-def/src/generics.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl GenericParams {
195195
}
196196
}
197197

198-
pub(crate) fn fill(&mut self, lower_ctx: &LowerCtx, node: &dyn HasGenericParams) {
198+
pub(crate) fn fill(&mut self, lower_ctx: &LowerCtx<'_>, node: &dyn HasGenericParams) {
199199
if let Some(params) = node.generic_param_list() {
200200
self.fill_params(lower_ctx, params)
201201
}
@@ -206,7 +206,7 @@ impl GenericParams {
206206

207207
pub(crate) fn fill_bounds(
208208
&mut self,
209-
lower_ctx: &LowerCtx,
209+
lower_ctx: &LowerCtx<'_>,
210210
node: &dyn ast::HasTypeBounds,
211211
target: Either<TypeRef, LifetimeRef>,
212212
) {
@@ -217,7 +217,7 @@ impl GenericParams {
217217
}
218218
}
219219

220-
fn fill_params(&mut self, lower_ctx: &LowerCtx, params: ast::GenericParamList) {
220+
fn fill_params(&mut self, lower_ctx: &LowerCtx<'_>, params: ast::GenericParamList) {
221221
for type_or_const_param in params.type_or_const_params() {
222222
match type_or_const_param {
223223
ast::TypeOrConstParam::Type(type_param) => {
@@ -259,7 +259,7 @@ impl GenericParams {
259259
}
260260
}
261261

262-
fn fill_where_predicates(&mut self, lower_ctx: &LowerCtx, where_clause: ast::WhereClause) {
262+
fn fill_where_predicates(&mut self, lower_ctx: &LowerCtx<'_>, where_clause: ast::WhereClause) {
263263
for pred in where_clause.predicates() {
264264
let target = if let Some(type_ref) = pred.ty() {
265265
Either::Left(TypeRef::from_ast(lower_ctx, type_ref))
@@ -293,7 +293,7 @@ impl GenericParams {
293293

294294
fn add_where_predicate_from_bound(
295295
&mut self,
296-
lower_ctx: &LowerCtx,
296+
lower_ctx: &LowerCtx<'_>,
297297
bound: ast::TypeBound,
298298
hrtb_lifetimes: Option<&Box<[Name]>>,
299299
target: Either<TypeRef, LifetimeRef>,

crates/hir-def/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
//! Note that `hir_def` is a work in progress, so not all of the above is
88
//! actually true.
99
10+
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
11+
1012
#[allow(unused)]
1113
macro_rules! eprintln {
1214
($($tt:tt)*) => { stdx::eprintln!($($tt)*) };

crates/hir-def/src/nameres/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1509,7 +1509,7 @@ impl ModCollector<'_, '_> {
15091509
let module = self.def_collector.def_map.module_id(self.module_id);
15101510
let def_map = &mut self.def_collector.def_map;
15111511
let update_def =
1512-
|def_collector: &mut DefCollector, id, name: &Name, vis, has_constructor| {
1512+
|def_collector: &mut DefCollector<'_>, id, name: &Name, vis, has_constructor| {
15131513
def_collector.def_map.modules[self.module_id].scope.declare(id);
15141514
def_collector.update(
15151515
self.module_id,

crates/hir-def/src/path.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub enum GenericArg {
8888
impl Path {
8989
/// Converts an `ast::Path` to `Path`. Works with use trees.
9090
/// It correctly handles `$crate` based path from macro call.
91-
pub fn from_src(path: ast::Path, ctx: &LowerCtx) -> Option<Path> {
91+
pub fn from_src(path: ast::Path, ctx: &LowerCtx<'_>) -> Option<Path> {
9292
lower::lower_path(path, ctx)
9393
}
9494

@@ -188,7 +188,10 @@ impl<'a> PathSegments<'a> {
188188
}
189189

190190
impl GenericArgs {
191-
pub(crate) fn from_ast(lower_ctx: &LowerCtx, node: ast::GenericArgList) -> Option<GenericArgs> {
191+
pub(crate) fn from_ast(
192+
lower_ctx: &LowerCtx<'_>,
193+
node: ast::GenericArgList,
194+
) -> Option<GenericArgs> {
192195
lower::lower_generic_args(lower_ctx, node)
193196
}
194197

0 commit comments

Comments
 (0)