Enable extra warnings required by rust-lang/rust

This commit is contained in:
Amos Wenger 2022-07-20 14:59:42 +02:00
parent 0ded8e734f
commit 23d25a3094
38 changed files with 84 additions and 0 deletions

View File

@ -1,4 +1,7 @@
//! base_db defines basic database traits. The concrete DB is defined by ide.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
mod input;
mod change;
pub mod fixture;

View File

@ -1,5 +1,7 @@
//! cfg defines conditional compiling options, `cfg` attribute parser and evaluator
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
mod cfg_expr;
mod dnf;
#[cfg(test)]

View File

@ -2,6 +2,8 @@
//! another compatible command (f.x. clippy) in a background thread and provide
//! LSP diagnostics based on the output of the command.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
use std::{
fmt, io,
process::{ChildStderr, ChildStdout, Command, Stdio},

View File

@ -7,6 +7,8 @@
//! Note that `hir_def` is a work in progress, so not all of the above is
//! actually true.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
#[allow(unused)]
macro_rules! eprintln {
($($tt:tt)*) => { stdx::eprintln!($($tt)*) };

View File

@ -4,6 +4,8 @@
//! tree originates not from the text of some `FileId`, but from some macro
//! expansion.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
pub mod db;
pub mod ast_id_map;
pub mod name;

View File

@ -1,6 +1,8 @@
//! The type system. We currently use this to infer types for completion, hover
//! information and various assists.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
#[allow(unused)]
macro_rules! eprintln {
($($tt:tt)*) => { stdx::eprintln!($($tt)*) };

View File

@ -17,6 +17,7 @@
//! from the ide with completions, hovers, etc. It is a (soft, internal) boundary:
//! <https://www.tedinski.com/2018/02/06/system-boundaries.html>.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
#![recursion_limit = "512"]
mod semantics;

View File

@ -57,6 +57,9 @@
//!
//! See also this post:
//! <https://rust-analyzer.github.io/blog/2020/09/28/how-to-make-a-light-bulb.html>
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
#[allow(unused)]
macro_rules! eprintln {
($($tt:tt)*) => { stdx::eprintln!($($tt)*) };

View File

@ -1,5 +1,7 @@
//! `completions` crate provides utilities for generating completions of user input.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
mod completions;
mod config;
mod context;

View File

@ -2,6 +2,8 @@
//!
//! It is mainly a `HirDatabase` for semantic analysis, plus a `SymbolsDatabase`, for fuzzy search.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
mod apply_change;
pub mod active_parameter;

View File

@ -23,6 +23,8 @@
//! There are also a couple of ad-hoc diagnostics implemented directly here, we
//! don't yet have a great pattern for how to do them properly.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
mod handlers {
pub(crate) mod break_outside_of_loop;
pub(crate) mod inactive_code;

View File

@ -3,6 +3,8 @@
//! Allows searching the AST for code that matches one or more patterns and then replacing that code
//! based on a template.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
// Feature: Structural Search and Replace
//
// Search and replace with named wildcards that will match any expression, type, path, pattern or item.

View File

@ -9,6 +9,7 @@
// For proving that RootDatabase is RefUnwindSafe.
#![recursion_limit = "128"]
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
#[allow(unused)]
macro_rules! eprintln {

View File

@ -1,5 +1,7 @@
//! limit defines a struct to enforce limits.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
use std::sync::atomic::AtomicUsize;
/// Represents a struct used to enforce a numerical limit.

View File

@ -6,6 +6,8 @@
//! The tes for this functionality live in another crate:
//! `hir_def::macro_expansion_tests::mbe`.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
mod parser;
mod expander;
mod syntax_bridge;

View File

@ -16,6 +16,8 @@
//! Tests for this crate live in the `syntax` crate.
//!
//! [`Parser`]: crate::parser::Parser
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
#![allow(rustdoc::private_intra_doc_links)]
mod lexed_str;

View File

@ -1,5 +1,8 @@
//! Thin wrappers around `std::path`, distinguishing between absolute and
//! relative paths.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
use std::{
borrow::Borrow,
ffi::OsStr,

View File

@ -5,6 +5,8 @@
//! is used to provide basic infrastructure for communication between two
//! processes: Client (RA itself), Server (the external program)
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
pub mod msg;
mod process;
mod version;

View File

@ -9,6 +9,8 @@
//! RA than `proc-macro2` token stream.
//! * By **copying** the whole rustc `lib_proc_macro` code, we are able to build this with `stable`
//! rustc rather than `unstable`. (Although in general ABI compatibility is still an issue)…
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
#![allow(unreachable_pub)]
mod dylib;

View File

@ -1,5 +1,7 @@
//! Exports a few trivial procedural macros for testing.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
use proc_macro::{Group, Ident, Punct, TokenStream, TokenTree};
#[proc_macro]

View File

@ -1,4 +1,6 @@
//! Exports a few trivial procedural macros for testing.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
pub static PROC_MACRO_TEST_LOCATION: &str =
include_str!(concat!(env!("OUT_DIR"), "/proc_macro_test_location.txt"));

View File

@ -1,5 +1,7 @@
//! A collection of tools for profiling rust-analyzer.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
mod stop_watch;
mod memory_usage;
#[cfg(feature = "cpu_profiler")]

View File

@ -15,6 +15,8 @@
//! procedural macros).
//! * Lowering of concrete model to a [`base_db::CrateGraph`]
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
mod manifest_path;
mod cargo_workspace;
mod cfg_flag;

View File

@ -1,6 +1,9 @@
//! Driver for rust-analyzer.
//!
//! Based on cli flags, either spawns an LSP server, or runs a batch analysis
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
mod logger;
mod rustc_wrapper;

View File

@ -9,6 +9,8 @@
//! The `cli` submodule implements some batch-processing analysis, primarily as
//! a debugging aid.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
pub mod cli;
#[allow(unused)]

View File

@ -8,6 +8,8 @@
//! specific JSON shapes here -- there's little value in such tests, as we can't
//! be sure without a real client anyway.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
mod sourcegen;
mod tidy;
mod testdir;

View File

@ -6,6 +6,8 @@
//!
//! This crate contains utilities to make this kind of source-gen easy.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
use std::{
fmt, fs, mem,
path::{Path, PathBuf},

View File

@ -1,4 +1,7 @@
//! Missing batteries for standard libraries.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
use std::process::Command;
use std::{cmp::Ordering, ops, time::Instant};
use std::{io as sio, iter};

View File

@ -19,6 +19,8 @@
//! [RFC]: <https://github.com/rust-lang/rfcs/pull/2256>
//! [Swift]: <https://github.com/apple/swift/blob/13d593df6f359d0cb2fc81cfaac273297c539455/lib/Syntax/README.md>
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
#[allow(unused)]
macro_rules! eprintln {
($($tt:tt)*) => { stdx::eprintln!($($tt)*) };

View File

@ -6,6 +6,8 @@
//! * Extracting markup (mainly, `$0` markers) out of fixture strings.
//! * marks (see the eponymous module).
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
pub mod bench_fixture;
mod fixture;
mod assert_linear;

View File

@ -4,6 +4,8 @@
//! so `TextEdit` is the ultimate representation of the work done by
//! rust-analyzer.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
use itertools::Itertools;
use std::cmp::max;
pub use text_size::{TextRange, TextSize};

View File

@ -1,4 +1,7 @@
//! Discovery of `cargo` & `rustc` executables.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
use std::{env, iter, path::PathBuf};
pub fn cargo() -> PathBuf {

View File

@ -1,6 +1,9 @@
//! `tt` crate defines a `TokenTree` data structure: this is the interface (both
//! input and output) of macros. It closely mirrors `proc_macro` crate's
//! `TokenTree`.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
use std::fmt;
use stdx::impl_from;

View File

@ -6,6 +6,9 @@
//!
//! Hopefully, one day a reliable file watching/walking crate appears on
//! crates.io, and we can reduce this to trivial glue code.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
use std::fs;
use crossbeam_channel::{never, select, unbounded, Receiver, Sender};

View File

@ -37,6 +37,9 @@
//! [`FileSet`]: file_set::FileSet
//! [`Handle`]: loader::Handle
//! [`Entries`]: loader::Entry
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
mod anchored_path;
pub mod file_set;
pub mod loader;

View File

@ -1,5 +1,6 @@
//! Yet another index-based arena.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
#![warn(missing_docs)]
use std::{

View File

@ -3,6 +3,9 @@
//! control the message dispatch loop yourself.
//!
//! Run with `RUST_LOG=lsp_server=debug` to see all the messages.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
mod msg;
mod stdio;
mod error;

View File

@ -7,6 +7,9 @@
//!
//! This binary is integrated into the `cargo` command line by using an alias in
//! `.cargo/config`.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
mod flags;
mod install;