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. //! 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 input;
mod change; mod change;
pub mod fixture; pub mod fixture;

View file

@ -1,5 +1,7 @@
//! cfg defines conditional compiling options, `cfg` attribute parser and evaluator //! 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 cfg_expr;
mod dnf; mod dnf;
#[cfg(test)] #[cfg(test)]

View file

@ -2,6 +2,8 @@
//! another compatible command (f.x. clippy) in a background thread and provide //! another compatible command (f.x. clippy) in a background thread and provide
//! LSP diagnostics based on the output of the command. //! LSP diagnostics based on the output of the command.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
use std::{ use std::{
fmt, io, fmt, io,
process::{ChildStderr, ChildStdout, Command, Stdio}, 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 //! Note that `hir_def` is a work in progress, so not all of the above is
//! actually true. //! actually true.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
#[allow(unused)] #[allow(unused)]
macro_rules! eprintln { macro_rules! eprintln {
($($tt:tt)*) => { stdx::eprintln!($($tt)*) }; ($($tt:tt)*) => { stdx::eprintln!($($tt)*) };

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2,6 +2,8 @@
//! //!
//! It is mainly a `HirDatabase` for semantic analysis, plus a `SymbolsDatabase`, for fuzzy search. //! 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; mod apply_change;
pub mod active_parameter; pub mod active_parameter;

View file

@ -23,6 +23,8 @@
//! There are also a couple of ad-hoc diagnostics implemented directly here, we //! 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. //! 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 { mod handlers {
pub(crate) mod break_outside_of_loop; pub(crate) mod break_outside_of_loop;
pub(crate) mod inactive_code; 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 //! Allows searching the AST for code that matches one or more patterns and then replacing that code
//! based on a template. //! based on a template.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
// Feature: Structural Search and Replace // Feature: Structural Search and Replace
// //
// Search and replace with named wildcards that will match any expression, type, path, pattern or item. // 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. // For proving that RootDatabase is RefUnwindSafe.
#![recursion_limit = "128"] #![recursion_limit = "128"]
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
#[allow(unused)] #[allow(unused)]
macro_rules! eprintln { macro_rules! eprintln {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -9,6 +9,8 @@
//! RA than `proc-macro2` token stream. //! RA than `proc-macro2` token stream.
//! * By **copying** the whole rustc `lib_proc_macro` code, we are able to build this with `stable` //! * 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)… //! 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)] #![allow(unreachable_pub)]
mod dylib; mod dylib;

View file

@ -1,5 +1,7 @@
//! Exports a few trivial procedural macros for testing. //! 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}; use proc_macro::{Group, Ident, Punct, TokenStream, TokenTree};
#[proc_macro] #[proc_macro]

View file

@ -1,4 +1,6 @@
//! Exports a few trivial procedural macros for testing. //! 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 = pub static PROC_MACRO_TEST_LOCATION: &str =
include_str!(concat!(env!("OUT_DIR"), "/proc_macro_test_location.txt")); 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. //! A collection of tools for profiling rust-analyzer.
#![warn(rust_2018_idioms, unused_lifetimes, semicolon_in_expressions_from_macros)]
mod stop_watch; mod stop_watch;
mod memory_usage; mod memory_usage;
#[cfg(feature = "cpu_profiler")] #[cfg(feature = "cpu_profiler")]

View file

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

View file

@ -1,6 +1,9 @@
//! Driver for rust-analyzer. //! Driver for rust-analyzer.
//! //!
//! Based on cli flags, either spawns an LSP server, or runs a batch analysis //! 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 logger;
mod rustc_wrapper; mod rustc_wrapper;

View file

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

View file

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

View file

@ -6,6 +6,8 @@
//! //!
//! This crate contains utilities to make this kind of source-gen easy. //! 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::{ use std::{
fmt, fs, mem, fmt, fs, mem,
path::{Path, PathBuf}, path::{Path, PathBuf},

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -6,6 +6,9 @@
//! //!
//! Hopefully, one day a reliable file watching/walking crate appears on //! Hopefully, one day a reliable file watching/walking crate appears on
//! crates.io, and we can reduce this to trivial glue code. //! 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 std::fs;
use crossbeam_channel::{never, select, unbounded, Receiver, Sender}; use crossbeam_channel::{never, select, unbounded, Receiver, Sender};

View file

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

View file

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

View file

@ -3,6 +3,9 @@
//! control the message dispatch loop yourself. //! control the message dispatch loop yourself.
//! //!
//! Run with `RUST_LOG=lsp_server=debug` to see all the messages. //! 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 msg;
mod stdio; mod stdio;
mod error; mod error;

View file

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