Skip to content

Commit 717ba1d

Browse files
committed
Clippy fixes
1 parent a12ccd5 commit 717ba1d

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

crates/base-db/src/change.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ impl FileChange {
6868
let source_root = db.source_root(source_root_id);
6969
let durability = durability(&source_root);
7070
// XXX: can't actually remove the file, just reset the text
71-
let text = text.as_ref().map(String::as_str).unwrap_or_else(|| "");
72-
db.set_file_text_with_durability(file_id, text, durability)
71+
let text = text.unwrap_or_default();
72+
db.set_file_text_with_durability(file_id, &text, durability)
7373
}
7474
if let Some(crate_graph) = self.crate_graph {
7575
db.set_crate_graph_with_durability(Arc::new(crate_graph), Durability::HIGH);

crates/base-db/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl<Db: ?Sized + SourceDatabaseExt> SourceDatabaseExt2 for Db {
135135
durability: Durability,
136136
) {
137137
let bytes = text.as_bytes();
138-
let compressed = lz4_flex::compress_prepend_size(&bytes);
138+
let compressed = lz4_flex::compress_prepend_size(bytes);
139139
self.set_compressed_file_text_with_durability(
140140
file_id,
141141
Arc::from(compressed.as_slice()),

crates/test-fixture/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ impl ChangeFixture {
149149
for entry in fixture {
150150
let text = if entry.text.contains(CURSOR_MARKER) {
151151
if entry.text.contains(ESCAPED_CURSOR_MARKER) {
152-
entry.text.replace(ESCAPED_CURSOR_MARKER, CURSOR_MARKER).into()
152+
entry.text.replace(ESCAPED_CURSOR_MARKER, CURSOR_MARKER)
153153
} else {
154154
let (range_or_offset, text) = extract_range_or_offset(&entry.text);
155155
assert!(file_position.is_none());
156156
file_position = Some((file_id, range_or_offset));
157-
text.into()
157+
text
158158
}
159159
} else {
160160
entry.text.as_str().into()
@@ -251,7 +251,7 @@ impl ChangeFixture {
251251
fs.insert(core_file, VfsPath::new_virtual_path("/sysroot/core/lib.rs".to_owned()));
252252
roots.push(SourceRoot::new_library(fs));
253253

254-
source_change.change_file(core_file, Some(mini_core.source_code().into()));
254+
source_change.change_file(core_file, Some(mini_core.source_code()));
255255

256256
let all_crates = crate_graph.crates_in_topological_order();
257257

@@ -287,7 +287,7 @@ impl ChangeFixture {
287287
);
288288
roots.push(SourceRoot::new_library(fs));
289289

290-
source_change.change_file(proc_lib_file, Some(source.into()));
290+
source_change.change_file(proc_lib_file, Some(source));
291291

292292
let all_crates = crate_graph.crates_in_topological_order();
293293

0 commit comments

Comments
 (0)