Skip to content

Commit a5da770

Browse files
committed
Fix function calls
1 parent fc8024d commit a5da770

File tree

10 files changed

+9
-12
lines changed

10 files changed

+9
-12
lines changed

crates/ra_analysis/src/descriptors.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ impl Link {
183183
root: ast::Root<'a>,
184184
) -> ast::Module<'a> {
185185
modules(root)
186-
.filter(|(name, _)| name == &tree.link(self).name)
187-
.next()
186+
.find(|(name, _)| name == &tree.link(self).name)
188187
.unwrap()
189188
.1
190189
}

crates/ra_analysis/src/imp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ impl AnalysisImpl {
393393

394394
// If we have a method call eat the first param since it's just self.
395395
if has_self {
396-
commas = commas + 1;
396+
commas += 1;
397397
}
398398

399399
current_parameter = Some(commas);

crates/ra_editor/src/typing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub fn join_lines(file: &File, range: TextRange) -> LocalEdit {
5858
pub fn on_enter(file: &File, offset: TextUnit) -> Option<LocalEdit> {
5959
let comment = find_leaf_at_offset(file.syntax(), offset)
6060
.left_biased()
61-
.and_then(|it| ast::Comment::cast(it))?;
61+
.and_then(ast::Comment::cast)?;
6262

6363
if let ast::CommentFlavor::Multiline = comment.flavor() {
6464
return None;

crates/ra_lsp_server/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn main() -> Result<()> {
1818
.directory("log")
1919
.start()?;
2020
info!("lifecycle: server started");
21-
match ::std::panic::catch_unwind(|| main_inner()) {
21+
match ::std::panic::catch_unwind(main_inner) {
2222
Ok(res) => {
2323
info!("lifecycle: terminating process with {:?}", res);
2424
res

crates/ra_lsp_server/src/main_loop/handlers.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ pub fn handle_runnables(
289289
.filter_map(|ws| {
290290
let tgt = ws.target_by_root(path)?;
291291
Some((
292-
tgt.package(ws).name(ws).clone(),
293-
tgt.name(ws).clone(),
292+
tgt.package(ws).name(ws),
293+
tgt.name(ws),
294294
tgt.kind(ws),
295295
))
296296
})

crates/ra_lsp_server/src/project_model.rs

-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ pub fn workspace_loader() -> (Worker<PathBuf, Result<CargoWorkspace>>, ThreadWat
173173
1,
174174
|input_receiver, output_sender| {
175175
input_receiver
176-
.into_iter()
177176
.map(|path| CargoWorkspace::from_cargo_metadata(path.as_path()))
178177
.for_each(|it| output_sender.send(it))
179178
},

crates/ra_lsp_server/src/vfs.rs

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ pub fn roots_loader() -> (Worker<PathBuf, (PathBuf, Vec<FileEvent>)>, ThreadWatc
2424
128,
2525
|input_receiver, output_sender| {
2626
input_receiver
27-
.into_iter()
2827
.map(|path| {
2928
debug!("loading {} ...", path.as_path().display());
3029
let events = load_root(path.as_path());

crates/ra_syntax/src/lexer/ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl<'s> Ptr<'s> {
3131
/// For example, 0 will return the current token, 1 will return the next, etc.
3232
pub fn nth(&self, n: u32) -> Option<char> {
3333
let mut chars = self.chars().peekable();
34-
chars.by_ref().skip(n as usize).next()
34+
chars.by_ref().nth(n as usize)
3535
}
3636

3737
/// Checks whether the current character is `c`.

crates/ra_syntax/src/reparsing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ fn find_reparsable_node(
135135
}
136136

137137
fn is_balanced(tokens: &[Token]) -> bool {
138-
if tokens.len() == 0
138+
if tokens.is_empty()
139139
|| tokens.first().unwrap().kind != L_CURLY
140140
|| tokens.last().unwrap().kind != R_CURLY
141141
{

crates/ra_syntax/src/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::fmt::Write;
55

66
/// Parse a file and create a string representation of the resulting parse tree.
77
pub fn dump_tree(syntax: SyntaxNodeRef) -> String {
8-
let mut errors: Vec<_> = syntax.root_data().iter().cloned().collect();
8+
let mut errors: Vec<_> = syntax.root_data().to_vec();
99
errors.sort_by_key(|e| e.offset);
1010
let mut err_pos = 0;
1111
let mut level = 0;

0 commit comments

Comments
 (0)