mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 21:37:54 +02:00
Rust 1.85, edition=2024 (#15741)
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
use crate::{
|
||||
NuStyle,
|
||||
nu_style::{color_from_hex, lookup_style},
|
||||
parse_nustyle, NuStyle,
|
||||
parse_nustyle,
|
||||
};
|
||||
use nu_ansi_term::Style;
|
||||
use nu_protocol::{Record, Value};
|
||||
@ -67,11 +68,7 @@ fn get_style_from_value(record: &Record) -> Option<NuStyle> {
|
||||
}
|
||||
}
|
||||
|
||||
if was_set {
|
||||
Some(style)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
if was_set { Some(style) } else { None }
|
||||
}
|
||||
|
||||
fn color_string_to_nustyle(color_string: &str) -> Style {
|
||||
@ -92,7 +89,7 @@ fn color_string_to_nustyle(color_string: &str) -> Style {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use nu_ansi_term::{Color, Style};
|
||||
use nu_protocol::{record, Span, Value};
|
||||
use nu_protocol::{Span, Value, record};
|
||||
|
||||
#[test]
|
||||
fn test_color_string_to_nustyle_empty_string() {
|
||||
|
@ -47,11 +47,7 @@ fn style_get_attr(s: Style) -> Option<String> {
|
||||
attrs.push('u');
|
||||
};
|
||||
|
||||
if attrs.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(attrs)
|
||||
}
|
||||
if attrs.is_empty() { None } else { Some(attrs) }
|
||||
}
|
||||
|
||||
fn color_to_string(color: Color) -> Option<String> {
|
||||
|
@ -1,9 +1,10 @@
|
||||
use crate::{color_record_to_nustyle, lookup_ansi_color_style, text_style::Alignment, TextStyle};
|
||||
use crate::{TextStyle, color_record_to_nustyle, lookup_ansi_color_style, text_style::Alignment};
|
||||
use nu_ansi_term::{Color, Style};
|
||||
use nu_engine::ClosureEvalOnce;
|
||||
use nu_protocol::{
|
||||
Span, Value,
|
||||
engine::{Closure, EngineState, Stack},
|
||||
report_shell_error, Span, Value,
|
||||
report_shell_error,
|
||||
};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
@ -240,9 +241,11 @@ fn test_computable_style_closure_errors() {
|
||||
];
|
||||
let actual_repl = nu!(nu_repl_code(&inp));
|
||||
// Check that the error was printed
|
||||
assert!(actual_repl
|
||||
.err
|
||||
.contains("nu::shell::operator_incompatible_types"));
|
||||
assert!(
|
||||
actual_repl
|
||||
.err
|
||||
.contains("nu::shell::operator_incompatible_types")
|
||||
);
|
||||
// Check that the value was printed
|
||||
assert!(actual_repl.out.contains("bell"));
|
||||
}
|
||||
|
Reference in New Issue
Block a user