Clippy lints

This commit is contained in:
kjeremy 2019-12-20 15:14:30 -05:00
parent 9467f81c58
commit 0d5d63a80e
16 changed files with 67 additions and 77 deletions

View file

@ -131,7 +131,7 @@ pub fn main_loop(
let feature_flags = {
let mut ff = FeatureFlags::default();
for (flag, value) in config.feature_flags {
if let Err(_) = ff.set(flag.as_str(), value) {
if ff.set(flag.as_str(), value).is_err() {
log::error!("unknown feature flag: {:?}", flag);
show_message(
req::MessageType::Error,

View file

@ -164,7 +164,7 @@ pub fn handle_on_type_formatting(
// in `ra_ide`, the `on_type` invariant is that
// `text.char_at(position) == typed_char`.
position.offset = position.offset - TextUnit::of_char('.');
position.offset -= TextUnit::of_char('.');
let char_typed = params.ch.chars().next().unwrap_or('\0');
// We have an assist that inserts ` ` after typing `->` in `fn foo() ->{`,

View file

@ -287,19 +287,15 @@ impl WorldSnapshot {
///
/// When processing non-windows path, this is essentially the same as `Url::from_file_path`.
fn url_from_path_with_drive_lowercasing(path: impl AsRef<Path>) -> Result<Url> {
let component_has_windows_drive = path
.as_ref()
.components()
.find(|comp| {
if let Component::Prefix(c) = comp {
match c.kind() {
Prefix::Disk(_) | Prefix::VerbatimDisk(_) => return true,
_ => return false,
}
let component_has_windows_drive = path.as_ref().components().any(|comp| {
if let Component::Prefix(c) = comp {
match c.kind() {
Prefix::Disk(_) | Prefix::VerbatimDisk(_) => return true,
_ => return false,
}
false
})
.is_some();
}
false
});
// VSCode expects drive letters to be lowercased, where rust will uppercase the drive letters.
if component_has_windows_drive {