mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 05:38:46 +00:00
Merge #5699
5699: Fix clippy warnings r=matklad a=popzxc Currently clippy spawns a bunch of warnings on the `rust-analyzer` project. Nothing critical, but easy to fix, so I guess it won't harm. Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
This commit is contained in:
commit
4b3d99f98f
6 changed files with 15 additions and 10 deletions
|
@ -74,7 +74,7 @@ impl fmt::Display for Position {
|
|||
impl Expect {
|
||||
pub fn assert_eq(&self, actual: &str) {
|
||||
let trimmed = self.trimmed();
|
||||
if &trimmed == actual {
|
||||
if trimmed == actual {
|
||||
return;
|
||||
}
|
||||
Runtime::fail_expect(self, &trimmed, actual);
|
||||
|
|
|
@ -276,7 +276,7 @@ impl<'a> TtIter<'a> {
|
|||
Ok(tt::Subtree {
|
||||
delimiter: None,
|
||||
token_trees: vec![
|
||||
tt::Leaf::Punct(punct.clone()).into(),
|
||||
tt::Leaf::Punct(*punct).into(),
|
||||
tt::Leaf::Ident(ident.clone()).into(),
|
||||
],
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ impl ProcMacroProcessSrv {
|
|||
}
|
||||
Some(it) => it,
|
||||
};
|
||||
sender.send(Task { req: req.into(), result_tx }).unwrap();
|
||||
sender.send(Task { req, result_tx }).unwrap();
|
||||
let res = result_rx
|
||||
.recv()
|
||||
.map_err(|_| ra_tt::ExpansionError::Unknown("Proc macro thread is closed.".into()))?;
|
||||
|
|
|
@ -76,10 +76,6 @@ impl TextEdit {
|
|||
self.indels.iter()
|
||||
}
|
||||
|
||||
pub fn into_iter(self) -> vec::IntoIter<Indel> {
|
||||
self.indels.into_iter()
|
||||
}
|
||||
|
||||
pub fn apply(&self, text: &mut String) {
|
||||
match self.len() {
|
||||
0 => return,
|
||||
|
@ -141,6 +137,15 @@ impl TextEdit {
|
|||
}
|
||||
}
|
||||
|
||||
impl IntoIterator for TextEdit {
|
||||
type Item = Indel;
|
||||
type IntoIter = vec::IntoIter<Self::Item>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
self.indels.into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
impl TextEditBuilder {
|
||||
pub fn replace(&mut self, range: TextRange, replace_with: String) {
|
||||
self.indels.push(Indel::replace(range, replace_with))
|
||||
|
|
|
@ -107,7 +107,7 @@ fn print_debug_subtree(f: &mut fmt::Formatter<'_>, subtree: &Subtree, level: usi
|
|||
for (idx, child) in subtree.token_trees.iter().enumerate() {
|
||||
print_debug_token(f, child, level + 1)?;
|
||||
if idx != subtree.token_trees.len() - 1 {
|
||||
writeln!(f, "")?;
|
||||
writeln!(f)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ pub fn is_ci() -> bool {
|
|||
|
||||
pub trait SepBy: Sized {
|
||||
/// Returns an `impl fmt::Display`, which joins elements via a separator.
|
||||
fn sep_by<'a>(self, sep: &'a str) -> SepByBuilder<'a, Self>;
|
||||
fn sep_by(self, sep: &str) -> SepByBuilder<'_, Self>;
|
||||
}
|
||||
|
||||
impl<I> SepBy for I
|
||||
|
@ -18,7 +18,7 @@ where
|
|||
I: Iterator,
|
||||
I::Item: fmt::Display,
|
||||
{
|
||||
fn sep_by<'a>(self, sep: &'a str) -> SepByBuilder<'a, Self> {
|
||||
fn sep_by(self, sep: &str) -> SepByBuilder<'_, Self> {
|
||||
SepByBuilder::new(sep, self)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue