mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-01 04:26:12 +00:00
router: clippy fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
532140de86
commit
3facb7b455
@ -3,7 +3,7 @@ use anyhow::{bail, Error};
|
|||||||
/// Shell quote type
|
/// Shell quote type
|
||||||
pub use rustyline::completion::Quote;
|
pub use rustyline::completion::Quote;
|
||||||
|
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq, Eq)]
|
||||||
enum ParseMode {
|
enum ParseMode {
|
||||||
Space,
|
Space,
|
||||||
DoubleQuote,
|
DoubleQuote,
|
||||||
|
@ -355,7 +355,7 @@ struct TableColumn {
|
|||||||
|
|
||||||
fn format_table<W: Write>(
|
fn format_table<W: Write>(
|
||||||
output: W,
|
output: W,
|
||||||
list: &mut Vec<Value>,
|
list: &mut [Value],
|
||||||
schema: &dyn ObjectSchemaType,
|
schema: &dyn ObjectSchemaType,
|
||||||
options: &TableFormatOptions,
|
options: &TableFormatOptions,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
@ -526,13 +526,15 @@ fn render_table<W: Write>(
|
|||||||
|
|
||||||
let mut header = String::new();
|
let mut header = String::new();
|
||||||
for (i, name) in column_names.iter().enumerate() {
|
for (i, name) in column_names.iter().enumerate() {
|
||||||
|
use std::fmt::Write;
|
||||||
|
|
||||||
let column = &tabledata[i];
|
let column = &tabledata[i];
|
||||||
header.push(borders.column_separator);
|
header.push(borders.column_separator);
|
||||||
header.push(' ');
|
header.push(' ');
|
||||||
if column.right_align {
|
if column.right_align {
|
||||||
header.push_str(&format!("{:>width$}", name, width = column.width));
|
let _ = write!(header, "{:>width$}", name, width = column.width);
|
||||||
} else {
|
} else {
|
||||||
header.push_str(&format!("{:<width$}", name, width = column.width));
|
let _ = write!(header, "{:<width$}", name, width = column.width);
|
||||||
}
|
}
|
||||||
header.push(' ');
|
header.push(' ');
|
||||||
}
|
}
|
||||||
@ -558,6 +560,8 @@ fn render_table<W: Write>(
|
|||||||
let mut text = String::new();
|
let mut text = String::new();
|
||||||
let empty_string = String::new();
|
let empty_string = String::new();
|
||||||
for (i, _name) in column_names.iter().enumerate() {
|
for (i, _name) in column_names.iter().enumerate() {
|
||||||
|
use std::fmt::Write;
|
||||||
|
|
||||||
let column = &tabledata[i];
|
let column = &tabledata[i];
|
||||||
let lines = &column.cells[pos].lines;
|
let lines = &column.cells[pos].lines;
|
||||||
let line = lines.get(line_nr).unwrap_or(&empty_string);
|
let line = lines.get(line_nr).unwrap_or(&empty_string);
|
||||||
@ -573,9 +577,9 @@ fn render_table<W: Write>(
|
|||||||
|
|
||||||
let padding = column.width - UnicodeWidthStr::width(line.as_str());
|
let padding = column.width - UnicodeWidthStr::width(line.as_str());
|
||||||
if column.right_align {
|
if column.right_align {
|
||||||
text.push_str(&format!("{:>width$}{}", "", line, width = padding));
|
let _ = write!(text, "{:>width$}{}", "", line, width = padding);
|
||||||
} else {
|
} else {
|
||||||
text.push_str(&format!("{}{:<width$}", line, "", width = padding));
|
let _ = write!(text, "{}{:<width$}", line, "", width = padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
if !options.noborder {
|
if !options.noborder {
|
||||||
|
@ -47,7 +47,7 @@ pub trait RpcEnvironment: Any + AsAny + Send {
|
|||||||
/// We use this to enumerate the different environment types. Some methods
|
/// We use this to enumerate the different environment types. Some methods
|
||||||
/// needs to do different things when started from the command line interface,
|
/// needs to do different things when started from the command line interface,
|
||||||
/// or when executed from a privileged server running as root.
|
/// or when executed from a privileged server running as root.
|
||||||
#[derive(PartialEq, Copy, Clone)]
|
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum RpcEnvironmentType {
|
pub enum RpcEnvironmentType {
|
||||||
/// Command started from command line
|
/// Command started from command line
|
||||||
CLI,
|
CLI,
|
||||||
|
Loading…
Reference in New Issue
Block a user