Auto merge of #12981 - kadiwa4:remove_some_imports, r=Veykril

Remove imports that are also in edition 2021's prelude

small cleanup
This commit is contained in:
bors 2022-08-09 07:03:35 +00:00
commit e1e93c4438
18 changed files with 15 additions and 27 deletions

View file

@ -6,7 +6,7 @@
//! actual IO. See `vfs` and `project_model` in the `rust-analyzer` crate for how
//! actual IO is done and lowered to input.
use std::{fmt, iter::FromIterator, ops, panic::RefUnwindSafe, str::FromStr, sync::Arc};
use std::{fmt, ops, panic::RefUnwindSafe, str::FromStr, sync::Arc};
use cfg::CfgOptions;
use rustc_hash::{FxHashMap, FxHashSet};

View file

@ -2,7 +2,6 @@
use std::{
collections::HashMap,
convert::TryInto,
fmt::{Display, Write},
};

View file

@ -4,7 +4,7 @@
//! get a super-set of matches. Then, we we confirm each match using precise
//! name resolution.
use std::{convert::TryInto, mem, sync::Arc};
use std::{mem, sync::Arc};
use base_db::{FileId, FileRange, SourceDatabase, SourceDatabaseExt};
use hir::{DefWithBody, HasAttrs, HasSource, InFile, ModuleSource, Semantics, Visibility};

View file

@ -1,4 +1,4 @@
use std::{convert::TryInto, mem::discriminant};
use std::mem::discriminant;
use crate::{doc_links::token_as_doc_comment, FilePosition, NavigationTarget, RangeInfo, TryToNav};
use hir::{AsAssocItem, AssocItem, Semantics};

View file

@ -1,4 +1,4 @@
use std::{fmt, iter::FromIterator, sync::Arc};
use std::{fmt, sync::Arc};
use hir::{ExpandResult, MacroFile};
use ide_db::base_db::{

View file

@ -35,10 +35,7 @@
//! as we don't have bincode in Cargo.toml yet, lets stick with serde_json for
//! the time being.
use std::{
collections::{HashMap, VecDeque},
convert::TryInto,
};
use std::collections::{HashMap, VecDeque};
use serde::{Deserialize, Serialize};
use tt::TokenId;

View file

@ -157,7 +157,7 @@ impl From<TokenTree> for TokenStream {
}
/// Collects a number of token trees into a single stream.
impl iter::FromIterator<TokenTree> for TokenStream {
impl FromIterator<TokenTree> for TokenStream {
fn from_iter<I: IntoIterator<Item = TokenTree>>(trees: I) -> Self {
trees.into_iter().map(TokenStream::from).collect()
}
@ -165,7 +165,7 @@ impl iter::FromIterator<TokenTree> for TokenStream {
/// A "flattening" operation on token streams, collects token trees
/// from multiple token streams into a single stream.
impl iter::FromIterator<TokenStream> for TokenStream {
impl FromIterator<TokenStream> for TokenStream {
fn from_iter<I: IntoIterator<Item = TokenStream>>(streams: I) -> Self {
let mut builder = bridge::client::TokenStreamBuilder::new();
streams.into_iter().for_each(|stream| builder.push(stream.0));

View file

@ -12,7 +12,6 @@ use super::proc_macro::bridge::{self, server};
use std::collections::HashMap;
use std::hash::Hash;
use std::iter::FromIterator;
use std::ops::Bound;
use std::{ascii, vec::IntoIter};

View file

@ -207,7 +207,7 @@ impl ConcatStreamsHelper {
}
/// Collects a number of token trees into a single stream.
impl iter::FromIterator<TokenTree> for TokenStream {
impl FromIterator<TokenTree> for TokenStream {
fn from_iter<I: IntoIterator<Item = TokenTree>>(trees: I) -> Self {
trees.into_iter().map(TokenStream::from).collect()
}
@ -215,7 +215,7 @@ impl iter::FromIterator<TokenTree> for TokenStream {
/// A "flattening" operation on token streams, collects token trees
/// from multiple token streams into a single stream.
impl iter::FromIterator<TokenStream> for TokenStream {
impl FromIterator<TokenStream> for TokenStream {
fn from_iter<I: IntoIterator<Item = TokenStream>>(streams: I) -> Self {
let iter = streams.into_iter();
let mut builder = ConcatStreamsHelper::new(iter.size_hint().0);

View file

@ -12,7 +12,6 @@ use super::proc_macro::bridge::{self, server};
use std::collections::HashMap;
use std::hash::Hash;
use std::iter::FromIterator;
use std::ops::Bound;
use std::{ascii, vec::IntoIter};

View file

@ -207,7 +207,7 @@ impl ConcatStreamsHelper {
}
/// Collects a number of token trees into a single stream.
impl iter::FromIterator<TokenTree> for TokenStream {
impl FromIterator<TokenTree> for TokenStream {
fn from_iter<I: IntoIterator<Item = TokenTree>>(trees: I) -> Self {
trees.into_iter().map(TokenStream::from).collect()
}
@ -215,7 +215,7 @@ impl iter::FromIterator<TokenTree> for TokenStream {
/// A "flattening" operation on token streams, collects token trees
/// from multiple token streams into a single stream.
impl iter::FromIterator<TokenStream> for TokenStream {
impl FromIterator<TokenStream> for TokenStream {
fn from_iter<I: IntoIterator<Item = TokenStream>>(streams: I) -> Self {
let iter = streams.into_iter();
let mut builder = ConcatStreamsHelper::new(iter.size_hint().0);

View file

@ -12,7 +12,6 @@ use super::proc_macro::bridge::{self, server};
use std::collections::HashMap;
use std::hash::Hash;
use std::iter::FromIterator;
use std::ops::Bound;
use std::{ascii, vec::IntoIter};

View file

@ -20,7 +20,7 @@ use token_stream::TokenStreamBuilder;
mod symbol;
pub use symbol::*;
use std::{iter::FromIterator, ops::Bound};
use std::ops::Bound;
type Group = tt::Subtree;
type TokenTree = tt::TokenTree;

View file

@ -1,7 +1,6 @@
//! Handles dynamic library loading for proc macro
use std::{
convert::TryInto,
fmt,
fs::File,
io,

View file

@ -512,7 +512,7 @@ fn clippy_code_description(code: Option<&str>) -> Option<lsp_types::CodeDescript
#[cfg(test)]
#[cfg(not(windows))]
mod tests {
use std::{convert::TryInto, path::Path};
use std::path::Path;
use crate::{config::Config, global_state::GlobalState};

View file

@ -1386,7 +1386,7 @@ fn main() {
#[test]
#[cfg(target_os = "windows")]
fn test_lowercase_drive_letter() {
use std::{convert::TryInto, path::Path};
use std::path::Path;
let url = url_from_abs_path(Path::new("C:\\Test").try_into().unwrap());
assert_eq!(url.to_string(), "file:///c:/Test");

View file

@ -2,10 +2,7 @@
//!
//! We don't normally run fuzzying, so this is hopelessly bitrotten :(
use std::{
convert::TryInto,
str::{self, FromStr},
};
use std::str::{self, FromStr};
use text_edit::Indel;

View file

@ -6,7 +6,6 @@
use std::{
fmt,
hash::{Hash, Hasher},
iter::FromIterator,
marker::PhantomData,
ops::{Index, IndexMut, Range, RangeInclusive},
};