mirror of
https://github.com/TabbyML/tabby
synced 2024-11-21 16:03:07 +00:00
refactor: rust nightly format (#197)
* chore: turn on group format * turn on nightly fmt
This commit is contained in:
parent
f4442b104f
commit
272dde9769
7
.github/workflows/ci.yml
vendored
7
.github/workflows/ci.yml
vendored
@ -31,12 +31,11 @@ jobs:
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
target: ${{ matrix.target }}
|
||||
components: rustfmt, clippy
|
||||
toolchain: nightly
|
||||
components: rustfmt
|
||||
|
||||
- name: Cargo fmt
|
||||
run: cargo fmt --check
|
||||
run: cargo +nightly fmt --check
|
||||
|
||||
release-binary:
|
||||
needs: tests
|
||||
|
3
.rustfmt.toml
Normal file
3
.rustfmt.toml
Normal file
@ -0,0 +1,3 @@
|
||||
reorder_imports = true
|
||||
imports_granularity = "crate"
|
||||
group_imports = "StdExternalCrate"
|
@ -1,7 +1,7 @@
|
||||
use std::{env, path::PathBuf};
|
||||
|
||||
use cmake::Config;
|
||||
use rust_cxx_cmake_bridge::read_cmake_generated;
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
// Tell cargo to invalidate the built crate whenever the wrapper changes
|
||||
|
@ -1,5 +1,4 @@
|
||||
use std::io::Write;
|
||||
use std::path::PathBuf;
|
||||
use std::{io::Write, path::PathBuf};
|
||||
|
||||
// ## lib_name: "protobufd"
|
||||
// ## dir: "..../api_circuits/target/debug/build/lib-circuits-wrapper-49025516ce40925e/out/build/_deps/protobuf_fetch-build"
|
||||
|
@ -1,9 +1,12 @@
|
||||
use std::{
|
||||
fs,
|
||||
io::{BufWriter, Write},
|
||||
sync::Mutex,
|
||||
};
|
||||
|
||||
use chrono::Utc;
|
||||
use lazy_static::lazy_static;
|
||||
use serde::Serialize;
|
||||
use std::fs;
|
||||
use std::io::{BufWriter, Write};
|
||||
use std::sync::Mutex;
|
||||
|
||||
lazy_static! {
|
||||
static ref WRITER: Mutex<BufWriter<fs::File>> = {
|
||||
|
@ -1,7 +1,4 @@
|
||||
use std::cell::Cell;
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Mutex;
|
||||
use std::{cell::Cell, env, path::PathBuf, sync::Mutex};
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
use std::{collections::HashMap, fs, path::Path};
|
||||
|
||||
use anyhow::Result;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use tabby_common::path::ModelDir;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
|
@ -1,16 +1,12 @@
|
||||
mod cache_info;
|
||||
|
||||
use std::cmp;
|
||||
use std::fs;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use std::{cmp, fs, io::Write, path::Path};
|
||||
|
||||
use cache_info::CacheInfo;
|
||||
use futures_util::StreamExt;
|
||||
use indicatif::{ProgressBar, ProgressStyle};
|
||||
use tabby_common::path::ModelDir;
|
||||
|
||||
use cache_info::CacheInfo;
|
||||
|
||||
impl CacheInfo {
|
||||
async fn download(&mut self, model_id: &str, path: &str, prefer_local_file: bool) {
|
||||
// Create url.
|
||||
|
@ -1,7 +1,8 @@
|
||||
mod repository;
|
||||
|
||||
use job_scheduler::{Job, JobScheduler};
|
||||
use std::time::Duration;
|
||||
|
||||
use job_scheduler::{Job, JobScheduler};
|
||||
use tracing::info;
|
||||
|
||||
pub fn scheduler() {
|
||||
|
@ -1,13 +1,11 @@
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use std::{path::PathBuf, process::Command};
|
||||
|
||||
use filenamify::filenamify;
|
||||
use tabby_common::{
|
||||
config::{Config, Repository},
|
||||
path::repositories_dir,
|
||||
};
|
||||
|
||||
use filenamify::filenamify;
|
||||
|
||||
trait ConfigExt {
|
||||
fn sync_repositories(&self);
|
||||
}
|
||||
@ -71,11 +69,13 @@ pub fn sync_repositories() {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use tabby_common::{
|
||||
config::{Config, Repository},
|
||||
path::set_tabby_root,
|
||||
};
|
||||
use temp_testdir::*;
|
||||
|
||||
use tabby_common::config::{Config, Repository};
|
||||
use tabby_common::path::set_tabby_root;
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
|
@ -1,10 +1,10 @@
|
||||
use std::{path::Path, sync::Arc};
|
||||
|
||||
use axum::{extract::State, Json};
|
||||
use ctranslate2_bindings::{
|
||||
TextInferenceEngine, TextInferenceEngineCreateOptionsBuilder, TextInferenceOptionsBuilder,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use strfmt::{strfmt, strfmt_builder};
|
||||
use tabby_common::{events, path::ModelDir};
|
||||
use utoipa::ToSchema;
|
||||
|
@ -1,6 +1,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use regex::Regex;
|
||||
use std::collections::HashMap;
|
||||
|
||||
lazy_static! {
|
||||
static ref DEFAULT: Regex = Regex::new(r"(?m)\n\n").unwrap();
|
||||
|
@ -2,18 +2,20 @@ mod admin;
|
||||
mod completions;
|
||||
mod events;
|
||||
|
||||
use crate::Cli;
|
||||
use axum::{routing, Router, Server};
|
||||
use clap::{error::ErrorKind, Args, CommandFactory};
|
||||
use std::{
|
||||
net::{Ipv4Addr, SocketAddr},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use axum::{routing, Router, Server};
|
||||
use clap::{error::ErrorKind, Args, CommandFactory};
|
||||
use tower_http::cors::CorsLayer;
|
||||
use tracing::info;
|
||||
use utoipa::OpenApi;
|
||||
use utoipa_swagger_ui::SwaggerUi;
|
||||
|
||||
use crate::Cli;
|
||||
|
||||
#[derive(OpenApi)]
|
||||
#[openapi(
|
||||
paths(events::log_event, completions::completion,),
|
||||
|
Loading…
Reference in New Issue
Block a user