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
@ -74,7 +74,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
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 @@ pub(crate) fn expect_lifetime(&mut self) -> Result<tt::TokenTree, ()> {
|
||||
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 @@ pub fn send_task<R>(&self, req: Request) -> Result<R, ra_tt::ExpansionError>
|
||||
}
|
||||
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 @@ pub fn iter(&self) -> slice::Iter<'_, Indel> {
|
||||
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 @@ pub fn apply_to_offset(&self, offset: TextSize) -> Option<TextSize> {
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ impl<I> SepBy for I
|
||||
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 New Issue
Block a user