Skip to content

Commit f2bfe0f

Browse files
committed
chore: uncontroversial Clippy fixes
1 parent 2f6ffd4 commit f2bfe0f

File tree

4 files changed

+7
-18
lines changed

4 files changed

+7
-18
lines changed

crates/ggml/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ description = "Semi-idiomatic Rust bindings for the ggml library (from `ggml-sys
77
license = "MIT"
88

99
[dependencies]
10-
thiserror = { workspace = true }
1110
ggml-sys = { path = "sys", version = "0.2.0-dev" }
11+
12+
thiserror = { workspace = true }
1213
memmap2 = { workspace = true }
1314

1415
[dev-dependencies]

crates/ggml/src/format/loader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ pub fn load<E: Error, R: BufRead + Seek>(
167167
match container_type {
168168
ContainerType::Ggml
169169
| ContainerType::Ggmf(1)
170-
| ContainerType::Ggjt(1 | 2 | 3)
170+
| ContainerType::Ggjt(1..=3)
171171
| ContainerType::Ggla(1) => {}
172172
_ => return Err(LoadError::InvalidFormatVersion(container_type)),
173173
}

crates/llm-base/src/loader.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -653,12 +653,7 @@ impl TensorLoader<LoadError> for MmapCompatibleLoader<'_> {
653653
path: Default::default(),
654654
})?;
655655

656-
let mut main_context = FileContext::new(
657-
&self.context,
658-
&mut self.file,
659-
&self.path,
660-
self.context.storage().as_mmap(),
661-
);
656+
let mut main_context = FileContext::new(&self.context, &mut self.file, &self.path);
662657

663658
let mut tensor = main_context.get_tensor(info)?;
664659

@@ -690,20 +685,13 @@ pub(crate) struct FileContext<'a> {
690685
context: &'a Context,
691686
file: &'a mut File,
692687
path: &'a Path,
693-
mmap: Option<&'a Mmap>,
694688
}
695689
impl<'a> FileContext<'a> {
696-
pub(crate) fn new(
697-
context: &'a Context,
698-
file: &'a mut File,
699-
path: &'a Path,
700-
mmap: Option<&'a Mmap>,
701-
) -> Self {
690+
pub(crate) fn new(context: &'a Context, file: &'a mut File, path: &'a Path) -> Self {
702691
Self {
703692
context,
704693
file,
705694
path,
706-
mmap,
707695
}
708696
}
709697

@@ -738,7 +726,7 @@ impl<'a> FileContext<'a> {
738726
}
739727
};
740728

741-
match self.mmap {
729+
match self.context.storage().as_mmap() {
742730
Some(mmap) => unsafe {
743731
let ptr = mmap.as_ptr().offset(info.start_offset as isize);
744732
tensor.set_data(ptr as *mut std::ffi::c_void);

crates/llm-base/src/lora.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl LoraAdapter {
106106
// Create a temporary context for the patching operations
107107
// TODO: test if GPU can be enabled (make it configurable)
108108
let patch_context = ggml::Context::new_with_allocate(patch_context_size);
109-
let mut patch_file = FileContext::new(&patch_context, &mut self.file, &self.path, None);
109+
let mut patch_file = FileContext::new(&patch_context, &mut self.file, &self.path);
110110

111111
// Load the A and B tensors
112112
let a = patch_file.get_tensor(&a_info)?;

0 commit comments

Comments
 (0)