Commit e99aa1e1 authored by Graham King's avatar Graham King Committed by GitHub
Browse files

chore: Upgrade Rust to 1.86 (#518)

Also upgrade the cargo resolver to v3, the default.

New clippy lints:
- `next_back()` instead of `last()` for a double-ended iterator. That avoids walking the whole list.
- ` repeat_n` instead of `repeat.take`. That avoids cloning.
- Doc indenting
parent 123f3386
......@@ -66,7 +66,7 @@ jobs:
if: ${{ env.ACT }}
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
rustup toolchain install 1.85.0-x86_64-unknown-linux-gnu
rustup toolchain install 1.86.0-x86_64-unknown-linux-gnu
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Set up Rust Toolchain Components
run: rustup component add rustfmt clippy
......
......@@ -22,7 +22,7 @@ members = [
"lib/bindings/c",
"lib/engines/*",
]
resolver = "2"
resolver = "3"
[workspace.package]
version = "0.1.0"
......
......@@ -73,13 +73,13 @@ rust-base:
ENV RUSTUP_HOME=/usr/local/rustup
ENV CARGO_HOME=/usr/local/cargo
ENV PATH=/usr/local/cargo/bin:$PATH
ENV RUST_VERSION=1.85.0
ENV RUST_VERSION=1.86.0
ENV RUSTARCH=x86_64-unknown-linux-gnu
RUN wget --tries=3 --waitretry=5 "https://static.rust-lang.org/rustup/archive/1.28.1/x86_64-unknown-linux-gnu/rustup-init" && \
echo "a3339fb004c3d0bb9862ba0bce001861fe5cbde9c10d16591eb3f39ee6cd3e7f *rustup-init" | sha256sum -c - && \
chmod +x rustup-init && \
./rustup-init -y --no-modify-path --profile minimal --default-toolchain 1.85.0 --default-host x86_64-unknown-linux-gnu && \
./rustup-init -y --no-modify-path --profile minimal --default-toolchain 1.86.0 --default-host x86_64-unknown-linux-gnu && \
rm rustup-init && \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME
......
......@@ -25,7 +25,7 @@ RUN apt update -y && \
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.85.0 \
RUST_VERSION=1.86.0 \
RUSTARCH=x86_64-unknown-linux-gnu
RUN wget --tries=3 --waitretry=5 "https://static.rust-lang.org/rustup/archive/1.28.1/${RUSTARCH}/rustup-init" && \
......
......@@ -68,7 +68,7 @@ RUN apt-get update && \
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.85.0 \
RUST_VERSION=1.86.0 \
RUSTARCH=x86_64-unknown-linux-gnu
RUN wget --tries=3 --waitretry=5 "https://static.rust-lang.org/rustup/archive/1.28.1/${RUSTARCH}/rustup-init" && \
......
......@@ -237,7 +237,7 @@ RUN apt update -y && \
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.85.0 \
RUST_VERSION=1.86.0 \
RUSTARCH=x86_64-unknown-linux-gnu
RUN wget --tries=3 --waitretry=5 "https://static.rust-lang.org/rustup/archive/1.28.1/${RUSTARCH}/rustup-init" && \
......
......@@ -100,7 +100,7 @@ pub async fn run(
.or_else(|| {
model_path
.as_ref()
.and_then(|p| p.iter().last())
.and_then(|p| p.iter().next_back())
.map(|n| n.to_string_lossy().into_owned())
})
.or_else(|| {
......@@ -116,7 +116,7 @@ pub async fn run(
if !inner_model_path.exists() {
model_name = inner_model_path
.iter()
.last()
.next_back()
.map(|s| s.to_string_lossy().to_string());
model_path = Some(hub::from_hf(inner_model_path).await?);
}
......
......@@ -139,7 +139,7 @@ impl
let (request, context) = incoming_request.transfer(());
let deltas = request.response_generator();
let ctx = context.context();
let req = request.inner.messages.into_iter().last().unwrap();
let req = request.inner.messages.into_iter().next_back().unwrap();
let prompt = match req {
async_openai::types::ChatCompletionRequestMessage::User(user_msg) => {
......
......@@ -822,9 +822,7 @@ impl KvIndexerInterface for KvIndexerSharded {
- (scores.frequencies.len() as i64);
if diff > 0 {
scores
.frequencies
.extend(iter::repeat(0).take(diff as usize));
scores.frequencies.extend(iter::repeat_n(0, diff as usize));
}
for i in 0..response.frequencies.len() {
......
......@@ -62,7 +62,7 @@ impl ModelDeploymentCard {
let model_name = model_name.map(|s| s.to_string()).or_else(|| {
gguf_file
.iter()
.last()
.next_back()
.map(|n| n.to_string_lossy().to_string())
});
let Some(model_name) = model_name else {
......
......@@ -18,7 +18,7 @@ members = [
"hello_world",
"service_metrics",
]
resolver = "2"
resolver = "3"
[workspace.package]
version = "0.1.0"
......
[toolchain]
channel = "1.85.0"
channel = "1.86.0"
......@@ -67,7 +67,7 @@ impl EndpointInfo {
let id = self
.subject
.split('-')
.last()
.next_back()
.ok_or_else(|| error!("No id found in subject"))?;
i64::from_str_radix(id, 16).map_err(|e| error!("Invalid id format: {}", e))
......
[toolchain]
channel = "1.85.0"
channel = "1.86.0"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment