refactor: Updated to the most recent Rust version with 2024 syntax
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use crate::utils::decode_bin;
|
||||
|
||||
use ansi_colours::AsRGB;
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use anyhow::{Context, Result, anyhow};
|
||||
use crossterm::style::{Color, Stylize};
|
||||
use crossterm::terminal;
|
||||
use std::collections::HashMap;
|
||||
@@ -122,10 +122,10 @@ impl MarkdownRender {
|
||||
line_type = LineType::Normal;
|
||||
}
|
||||
LineType::CodeBegin => {
|
||||
if code_syntax.is_none() {
|
||||
if let Some(syntax) = self.syntax_set.find_syntax_by_first_line(line) {
|
||||
code_syntax = Some(syntax.clone());
|
||||
}
|
||||
if code_syntax.is_none()
|
||||
&& let Some(syntax) = self.syntax_set.find_syntax_by_first_line(line)
|
||||
{
|
||||
code_syntax = Some(syntax.clone());
|
||||
}
|
||||
line_type = LineType::CodeInner;
|
||||
is_code = true;
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ mod stream;
|
||||
pub use self::markdown::{MarkdownRender, RenderOptions};
|
||||
use self::stream::{markdown_stream, raw_stream};
|
||||
|
||||
use crate::utils::{error_text, pretty_error, AbortSignal, IS_STDOUT_TERMINAL};
|
||||
use crate::utils::{AbortSignal, IS_STDOUT_TERMINAL, error_text, pretty_error};
|
||||
use crate::{client::SseEvent, config::GlobalConfig};
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use super::{MarkdownRender, SseEvent};
|
||||
|
||||
use crate::utils::{poll_abort_signal, spawn_spinner, AbortSignal};
|
||||
use crate::utils::{AbortSignal, poll_abort_signal, spawn_spinner};
|
||||
|
||||
use anyhow::Result;
|
||||
use crossterm::{
|
||||
@@ -8,7 +8,7 @@ use crossterm::{
|
||||
terminal::{self, disable_raw_mode, enable_raw_mode},
|
||||
};
|
||||
use std::{
|
||||
io::{stdout, Stdout, Write},
|
||||
io::{Stdout, Write, stdout},
|
||||
time::Duration,
|
||||
};
|
||||
use textwrap::core::display_width;
|
||||
|
||||
Reference in New Issue
Block a user