Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 4928a20

Browse files
authored
Merge pull request #769 from BORN2LOSE/clippy_warn
Fix some clippy warnings
2 parents 4439a86 + 6f52cd4 commit 4928a20

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/support/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub struct ExpectedMessage {
7474
impl ExpectedMessage {
7575
pub fn new(id: Option<u64>) -> ExpectedMessage {
7676
ExpectedMessage {
77-
id: id,
77+
id,
7878
contains: vec![],
7979
}
8080
}
@@ -91,7 +91,7 @@ pub fn read_message<R: Read>(reader: &mut BufReader<R>) -> io::Result<String> {
9191
loop {
9292
let mut header = String::new();
9393
reader.read_line(&mut header)?;
94-
if header.len() == 0 {
94+
if header.is_empty() {
9595
panic!("eof")
9696
}
9797
if header == "\r\n" {
@@ -146,7 +146,7 @@ pub fn expect_messages<R: Read>(reader: &mut BufReader<R>, expected: &[&Expected
146146
"Unexpected id"
147147
);
148148
}
149-
for c in expected.contains.iter() {
149+
for c in &expected.contains {
150150
found
151151
.find(c)
152152
.expect(&format!("Could not find `{}` in `{}`", c, found));
@@ -177,7 +177,7 @@ impl RlsHandle {
177177
let full_msg = format!("Content-Length: {}\r\n\r\n{}", s.len(), s);
178178
self.stdin.write(full_msg.as_bytes())
179179
}
180-
pub fn send(&mut self, j: serde_json::Value) -> io::Result<usize> {
180+
pub fn send(&mut self, j: &serde_json::Value) -> io::Result<usize> {
181181
self.send_string(&j.to_string())
182182
}
183183
pub fn notify(&mut self, method: &str, params: Option<serde_json::Value>) -> io::Result<usize> {
@@ -194,7 +194,7 @@ impl RlsHandle {
194194
})
195195
};
196196

197-
self.send(message)
197+
self.send(&message)
198198
}
199199
pub fn request(&mut self, id: u64, method: &str, params: Option<serde_json::Value>) -> io::Result<usize> {
200200
let message = if let Some(params) = params {
@@ -212,7 +212,7 @@ impl RlsHandle {
212212
})
213213
};
214214

215-
self.send(message)
215+
self.send(&message)
216216
}
217217
pub fn shutdown_exit(&mut self) {
218218
self.request(99999, "shutdown", None).unwrap();
@@ -242,7 +242,7 @@ struct FileBuilder {
242242

243243
impl FileBuilder {
244244
pub fn new(path: PathBuf, body: &str) -> FileBuilder {
245-
FileBuilder { path: path, body: body.to_string() }
245+
FileBuilder { path, body: body.to_string() }
246246
}
247247

248248
fn mk(&self) {
@@ -299,7 +299,7 @@ impl ProjectBuilder {
299299
// Create the empty directory
300300
self.root.root.mkdir_p();
301301

302-
for file in self.files.iter() {
302+
for file in &self.files {
303303
file.mk();
304304
}
305305

0 commit comments

Comments
 (0)