about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/check_unused.rs
AgeCommit message (Collapse)AuthorLines
2023-10-26Rollup merge of #116905 - Fenex:refactor/compiler/resolve, r=petrochenkovMatthias Krüger-11/+10
refactor(compiler/resolve): simplify some code Removes unnecessary allocate and double-sorting the same vector, makes the code a little nicer.
2023-10-22use visibility to check unused imports and delete some stmtsbohan-4/+1
2023-10-19refactor(compiler/resolve): simplify some codeVitaliy Busko-11/+10
Removes unnecessary allocates and double-sorting the same vector, makes the code a little nicer.
2023-07-30inline format!() args up to and including rustc_codegen_llvmMatthias Krüger-1/+1
2023-07-19Make it clearer that edition functions are >=, not ==Michael Goulet-1/+1
2023-05-24Use `is_some_and`/`is_ok_and` in less obvious spotsMaybe Waffle-9/+4
2023-05-24Use `Option::is_some_and` and `Result::is_ok_and` in the compilerMaybe Waffle-1/+1
2023-05-03Restrict `From<S>` for `{D,Subd}iagnosticMessage`.Nicholas Nethercote-1/+1
Currently a `{D,Subd}iagnosticMessage` can be created from any type that impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static, str>`, which are reasonable. It also includes `&String`, which is pretty weird, and results in many places making unnecessary allocations for patterns like this: ``` self.fatal(&format!(...)) ``` This creates a string with `format!`, takes a reference, passes the reference to `fatal`, which does an `into()`, which clones the reference, doing a second allocation. Two allocations for a single string, bleh. This commit changes the `From` impls so that you can only create a `{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static, str>`. This requires changing all the places that currently create one from a `&String`. Most of these are of the `&format!(...)` form described above; each one removes an unnecessary static `&`, plus an allocation when executed. There are also a few places where the existing use of `&String` was more reasonable; these now just use `clone()` at the call site. As well as making the code nicer and more efficient, this is a step towards possibly using `Cow<'static, str>` in `{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing the `From<&'a str>` impls to `From<&'static str>`, which is doable, but I'm not yet sure if it's worthwhile.
2023-04-09Migrate `sess.opts.tests` uses to `sess.is_test_crate()`blyxyas-1/+1
2023-03-22Move useless_anynous_reexport lint into unused_importsGuillaume Gomez-2/+40
2023-02-25Address review.Camille GILLOT-10/+6
2023-02-22Remove some resolver outputs.Camille GILLOT-1/+0
2023-02-22Move the unused extern crate check back to the resolver.Camille GILLOT-13/+125
2023-02-20Prepare for adding a `TyCtxt` to `Resolver`Oli Scherer-2/+2
2023-02-14Separate the lifetime of the session and the arena in the resolverOli Scherer-5/+5
2023-01-19Use UnordMap instead of FxHashMap in define_id_collections!().Michael Woerister-5/+5
2022-10-31resolve: Not all imports have their own `NodeId`Vadim Petrochenkov-4/+4
2022-09-27rustc_typeck to rustc_hir_analysislcnr-1/+1
2022-08-27rustc_middle: Remove `Visibility::Invisible`Vadim Petrochenkov-1/+1
2022-06-14Make ResolverAstLowering a struct.Camille GILLOT-1/+0
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-1/+1
2022-05-17Omit unnecessary help to add `#[cfg(test)]` when already annotatedKen Matsui-14/+21
2022-04-05span: move `MultiSpan`David Wood-2/+2
`MultiSpan` contains labels, which are more complicated with the introduction of diagnostic translation and will use types from `rustc_errors` - however, `rustc_errors` depends on `rustc_span` so `rustc_span` cannot use types like `DiagnosticMessage` without dependency cycles. Introduce a new `rustc_error_messages` crate that can contain `DiagnosticMessage` and `MultiSpan`. Signed-off-by: David Wood <david.wood@huawei.com>
2021-12-16suggest adding a `#[cfg(test)]` to test modulesTakayuki Maeda-1/+19
remove a empty line import `module_to_string` use `contains("test")` show a suggestion in case module starts_with/ends_with "test" replace `parent` with `containing`
2021-11-09Add `ty::Visibility::is_public()`inquisitivecrystal-2/+1
2021-08-22Stop tracking namespce in used_imports.Mara Bos-2/+1
The information was tracked, but unused.
2021-08-12Include attributes in removal span for unused imports.Mara Bos-1/+1
2020-09-10Attach `TokenStream` to `ast::Visibility`Aaron Hill-1/+1
A `Visibility` does not have outer attributes, so we only capture tokens when parsing a `macro_rules!` matcher
2020-08-30mv compiler to compiler/mark-0/+328