Skip to content

Commit

Permalink
Clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lnicola committed Mar 10, 2024
1 parent a12ccd5 commit 717ba1d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions crates/base-db/src/change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ impl FileChange {
let source_root = db.source_root(source_root_id);
let durability = durability(&source_root);
// XXX: can't actually remove the file, just reset the text
let text = text.as_ref().map(String::as_str).unwrap_or_else(|| "");
db.set_file_text_with_durability(file_id, text, durability)
let text = text.unwrap_or_default();
db.set_file_text_with_durability(file_id, &text, durability)
}
if let Some(crate_graph) = self.crate_graph {
db.set_crate_graph_with_durability(Arc::new(crate_graph), Durability::HIGH);
Expand Down
2 changes: 1 addition & 1 deletion crates/base-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl<Db: ?Sized + SourceDatabaseExt> SourceDatabaseExt2 for Db {
durability: Durability,
) {
let bytes = text.as_bytes();
let compressed = lz4_flex::compress_prepend_size(&bytes);
let compressed = lz4_flex::compress_prepend_size(bytes);
self.set_compressed_file_text_with_durability(
file_id,
Arc::from(compressed.as_slice()),
Expand Down
8 changes: 4 additions & 4 deletions crates/test-fixture/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ impl ChangeFixture {
for entry in fixture {
let text = if entry.text.contains(CURSOR_MARKER) {
if entry.text.contains(ESCAPED_CURSOR_MARKER) {
entry.text.replace(ESCAPED_CURSOR_MARKER, CURSOR_MARKER).into()
entry.text.replace(ESCAPED_CURSOR_MARKER, CURSOR_MARKER)
} else {
let (range_or_offset, text) = extract_range_or_offset(&entry.text);
assert!(file_position.is_none());
file_position = Some((file_id, range_or_offset));
text.into()
text
}
} else {
entry.text.as_str().into()
Expand Down Expand Up @@ -251,7 +251,7 @@ impl ChangeFixture {
fs.insert(core_file, VfsPath::new_virtual_path("/sysroot/core/lib.rs".to_owned()));
roots.push(SourceRoot::new_library(fs));

source_change.change_file(core_file, Some(mini_core.source_code().into()));
source_change.change_file(core_file, Some(mini_core.source_code()));

let all_crates = crate_graph.crates_in_topological_order();

Expand Down Expand Up @@ -287,7 +287,7 @@ impl ChangeFixture {
);
roots.push(SourceRoot::new_library(fs));

source_change.change_file(proc_lib_file, Some(source.into()));
source_change.change_file(proc_lib_file, Some(source));

let all_crates = crate_graph.crates_in_topological_order();

Expand Down

0 comments on commit 717ba1d

Please sign in to comment.