Fix warnings for Rust 1.51 (#3214)

* Fix warnings for Rust 1.51

* More fixes

* More fixes
This commit is contained in:
Jonathan Turner
2021-03-26 21:26:57 +13:00
committed by GitHub
parent 589fc0b8ad
commit 7e184b58b2
55 changed files with 325 additions and 400 deletions

View File

@ -184,21 +184,21 @@ pub(crate) use first::First;
pub(crate) use flatten::Command as Flatten;
pub(crate) use format::{FileSize, Format};
pub(crate) use from::From;
pub(crate) use from_csv::FromCSV;
pub(crate) use from_eml::FromEML;
pub(crate) use from_csv::FromCsv;
pub(crate) use from_eml::FromEml;
pub(crate) use from_ics::FromIcs;
pub(crate) use from_ini::FromINI;
pub(crate) use from_json::FromJSON;
pub(crate) use from_ods::FromODS;
pub(crate) use from_ssv::FromSSV;
pub(crate) use from_toml::FromTOML;
pub(crate) use from_tsv::FromTSV;
pub(crate) use from_url::FromURL;
pub(crate) use from_ini::FromIni;
pub(crate) use from_json::FromJson;
pub(crate) use from_ods::FromOds;
pub(crate) use from_ssv::FromSsv;
pub(crate) use from_toml::FromToml;
pub(crate) use from_tsv::FromTsv;
pub(crate) use from_url::FromUrl;
pub(crate) use from_vcf::FromVcf;
pub(crate) use from_xlsx::FromXLSX;
pub(crate) use from_xml::FromXML;
pub(crate) use from_yaml::FromYAML;
pub(crate) use from_yaml::FromYML;
pub(crate) use from_xlsx::FromXlsx;
pub(crate) use from_xml::FromXml;
pub(crate) use from_yaml::FromYaml;
pub(crate) use from_yaml::FromYml;
pub(crate) use get::Command as Get;
pub(crate) use group_by::Command as GroupBy;
pub(crate) use group_by_date::GroupByDate;
@ -272,15 +272,15 @@ pub(crate) use table::Table;
pub(crate) use tags::Tags;
pub(crate) use termsize::TermSize;
pub(crate) use to::To;
pub(crate) use to_csv::ToCSV;
pub(crate) use to_html::ToHTML;
pub(crate) use to_json::ToJSON;
pub(crate) use to_csv::ToCsv;
pub(crate) use to_html::ToHtml;
pub(crate) use to_json::ToJson;
pub(crate) use to_md::Command as ToMarkdown;
pub(crate) use to_toml::ToTOML;
pub(crate) use to_tsv::ToTSV;
pub(crate) use to_url::ToURL;
pub(crate) use to_xml::ToXML;
pub(crate) use to_yaml::ToYAML;
pub(crate) use to_toml::ToToml;
pub(crate) use to_tsv::ToTsv;
pub(crate) use to_url::ToUrl;
pub(crate) use to_xml::ToXml;
pub(crate) use to_yaml::ToYaml;
pub(crate) use touch::Touch;
pub(crate) use uniq::Uniq;
pub(crate) use url_::{UrlCommand, UrlHost, UrlPath, UrlQuery, UrlScheme};

View File

@ -190,30 +190,30 @@ pub fn create_default_context(interactive: bool) -> Result<EvaluationContext, Bo
whole_stream_command(MathCeil),
// File format output
whole_stream_command(To),
whole_stream_command(ToCSV),
whole_stream_command(ToHTML),
whole_stream_command(ToJSON),
whole_stream_command(ToCsv),
whole_stream_command(ToHtml),
whole_stream_command(ToJson),
whole_stream_command(ToMarkdown),
whole_stream_command(ToTOML),
whole_stream_command(ToTSV),
whole_stream_command(ToURL),
whole_stream_command(ToYAML),
whole_stream_command(ToXML),
whole_stream_command(ToToml),
whole_stream_command(ToTsv),
whole_stream_command(ToUrl),
whole_stream_command(ToYaml),
whole_stream_command(ToXml),
// File format input
whole_stream_command(From),
whole_stream_command(FromCSV),
whole_stream_command(FromEML),
whole_stream_command(FromTSV),
whole_stream_command(FromSSV),
whole_stream_command(FromINI),
whole_stream_command(FromJSON),
whole_stream_command(FromODS),
whole_stream_command(FromTOML),
whole_stream_command(FromURL),
whole_stream_command(FromXLSX),
whole_stream_command(FromXML),
whole_stream_command(FromYAML),
whole_stream_command(FromYML),
whole_stream_command(FromCsv),
whole_stream_command(FromEml),
whole_stream_command(FromTsv),
whole_stream_command(FromSsv),
whole_stream_command(FromIni),
whole_stream_command(FromJson),
whole_stream_command(FromOds),
whole_stream_command(FromToml),
whole_stream_command(FromUrl),
whole_stream_command(FromXlsx),
whole_stream_command(FromXml),
whole_stream_command(FromYaml),
whole_stream_command(FromYml),
whole_stream_command(FromIcs),
whole_stream_command(FromVcf),
// "Private" commands (not intended to be accessed directly)

View File

@ -4,16 +4,16 @@ use nu_engine::WholeStreamCommand;
use nu_errors::ShellError;
use nu_protocol::{Primitive, Signature, SyntaxShape, UntaggedValue, Value};
pub struct FromCSV;
pub struct FromCsv;
#[derive(Deserialize)]
pub struct FromCSVArgs {
pub struct FromCsvArgs {
noheaders: bool,
separator: Option<Value>,
}
#[async_trait]
impl WholeStreamCommand for FromCSV {
impl WholeStreamCommand for FromCsv {
fn name(&self) -> &str {
"from csv"
}
@ -71,7 +71,7 @@ async fn from_csv(args: CommandArgs) -> Result<OutputStream, ShellError> {
let name = args.call_info.name_tag.clone();
let (
FromCSVArgs {
FromCsvArgs {
noheaders,
separator,
},
@ -105,13 +105,13 @@ async fn from_csv(args: CommandArgs) -> Result<OutputStream, ShellError> {
#[cfg(test)]
mod tests {
use super::FromCSV;
use super::FromCsv;
use super::ShellError;
#[test]
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
test_examples(FromCSV {})
test_examples(FromCsv {})
}
}

View File

@ -6,18 +6,18 @@ use nu_errors::ShellError;
use nu_protocol::{ReturnSuccess, Signature, SyntaxShape, TaggedDictBuilder, UntaggedValue};
use nu_source::Tagged;
pub struct FromEML;
pub struct FromEml;
const DEFAULT_BODY_PREVIEW: usize = 50;
#[derive(Deserialize, Clone)]
pub struct FromEMLArgs {
pub struct FromEmlArgs {
#[serde(rename(deserialize = "preview-body"))]
preview_body: Option<Tagged<usize>>,
}
#[async_trait]
impl WholeStreamCommand for FromEML {
impl WholeStreamCommand for FromEml {
fn name(&self) -> &str {
"from eml"
}
@ -75,7 +75,7 @@ fn headerfieldvalue_to_value(tag: &Tag, value: &HeaderFieldValue) -> UntaggedVal
async fn from_eml(args: CommandArgs) -> Result<OutputStream, ShellError> {
let tag = args.call_info.name_tag.clone();
let (eml_args, input): (FromEMLArgs, _) = args.process().await?;
let (eml_args, input): (FromEmlArgs, _) = args.process().await?;
let value = input.collect_string(tag.clone()).await?;
let body_preview = eml_args
@ -121,13 +121,13 @@ async fn from_eml(args: CommandArgs) -> Result<OutputStream, ShellError> {
#[cfg(test)]
mod tests {
use super::FromEML;
use super::FromEml;
use super::ShellError;
#[test]
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
test_examples(FromEML {})
test_examples(FromEml {})
}
}

View File

@ -4,10 +4,10 @@ use nu_errors::ShellError;
use nu_protocol::{Primitive, Signature, TaggedDictBuilder, UntaggedValue, Value};
use std::collections::HashMap;
pub struct FromINI;
pub struct FromIni;
#[async_trait]
impl WholeStreamCommand for FromINI {
impl WholeStreamCommand for FromIni {
fn name(&self) -> &str {
"from ini"
}
@ -86,13 +86,13 @@ async fn from_ini(args: CommandArgs) -> Result<OutputStream, ShellError> {
#[cfg(test)]
mod tests {
use super::FromINI;
use super::FromIni;
use super::ShellError;
#[test]
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
test_examples(FromINI {})
test_examples(FromIni {})
}
}

View File

@ -3,15 +3,15 @@ use nu_engine::WholeStreamCommand;
use nu_errors::ShellError;
use nu_protocol::{Primitive, ReturnSuccess, Signature, TaggedDictBuilder, UntaggedValue, Value};
pub struct FromJSON;
pub struct FromJson;
#[derive(Deserialize)]
pub struct FromJSONArgs {
pub struct FromJsonArgs {
objects: bool,
}
#[async_trait]
impl WholeStreamCommand for FromJSON {
impl WholeStreamCommand for FromJson {
fn name(&self) -> &str {
"from json"
}
@ -71,7 +71,7 @@ pub fn from_json_string_to_value(s: String, tag: impl Into<Tag>) -> nu_json::Res
async fn from_json(args: CommandArgs) -> Result<OutputStream, ShellError> {
let name_tag = args.call_info.name_tag.clone();
let (FromJSONArgs { objects }, input) = args.process().await?;
let (FromJsonArgs { objects }, input) = args.process().await?;
let concat_string = input.collect_string(name_tag.clone()).await?;
let string_clone: Vec<_> = concat_string.item.lines().map(|x| x.to_string()).collect();
@ -135,13 +135,13 @@ async fn from_json(args: CommandArgs) -> Result<OutputStream, ShellError> {
#[cfg(test)]
mod tests {
use super::FromJSON;
use super::FromJson;
use super::ShellError;
#[test]
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
test_examples(FromJSON {})
test_examples(FromJson {})
}
}

View File

@ -6,15 +6,15 @@ use nu_errors::ShellError;
use nu_protocol::{ReturnSuccess, Signature, TaggedDictBuilder, UntaggedValue};
use std::io::Cursor;
pub struct FromODS;
pub struct FromOds;
#[derive(Deserialize)]
pub struct FromODSArgs {
pub struct FromOdsArgs {
noheaders: bool,
}
#[async_trait]
impl WholeStreamCommand for FromODS {
impl WholeStreamCommand for FromOds {
fn name(&self) -> &str {
"from ods"
}
@ -41,7 +41,7 @@ async fn from_ods(args: CommandArgs) -> Result<OutputStream, ShellError> {
let span = tag.span;
let (
FromODSArgs {
FromOdsArgs {
noheaders: _noheaders,
},
input,
@ -93,13 +93,13 @@ async fn from_ods(args: CommandArgs) -> Result<OutputStream, ShellError> {
#[cfg(test)]
mod tests {
use super::FromODS;
use super::FromOds;
use super::ShellError;
#[test]
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
test_examples(FromODS {})
test_examples(FromOds {})
}
}

View File

@ -6,10 +6,10 @@ use nu_protocol::{
};
use nu_source::Tagged;
pub struct FromSSV;
pub struct FromSsv;
#[derive(Deserialize)]
pub struct FromSSVArgs {
pub struct FromSsvArgs {
noheaders: bool,
#[serde(rename(deserialize = "aligned-columns"))]
aligned_columns: bool,
@ -21,7 +21,7 @@ const STRING_REPRESENTATION: &str = "from ssv";
const DEFAULT_MINIMUM_SPACES: usize = 2;
#[async_trait]
impl WholeStreamCommand for FromSSV {
impl WholeStreamCommand for FromSsv {
fn name(&self) -> &str {
STRING_REPRESENTATION
}
@ -250,7 +250,7 @@ fn from_ssv_string_to_value(
async fn from_ssv(args: CommandArgs) -> Result<OutputStream, ShellError> {
let name = args.call_info.name_tag.clone();
let (
FromSSVArgs {
FromSsvArgs {
noheaders,
aligned_columns,
minimum_spaces,
@ -489,9 +489,9 @@ mod tests {
#[test]
fn examples_work_as_expected() -> Result<(), ShellError> {
use super::FromSSV;
use super::FromSsv;
use crate::examples::test as test_examples;
test_examples(FromSSV {})
test_examples(FromSsv {})
}
}

View File

@ -3,10 +3,10 @@ use nu_engine::WholeStreamCommand;
use nu_errors::ShellError;
use nu_protocol::{Primitive, ReturnSuccess, Signature, TaggedDictBuilder, UntaggedValue, Value};
pub struct FromTOML;
pub struct FromToml;
#[async_trait]
impl WholeStreamCommand for FromTOML {
impl WholeStreamCommand for FromToml {
fn name(&self) -> &str {
"from toml"
}
@ -92,13 +92,13 @@ pub async fn from_toml(args: CommandArgs) -> Result<OutputStream, ShellError> {
#[cfg(test)]
mod tests {
use super::FromTOML;
use super::FromToml;
use super::ShellError;
#[test]
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
test_examples(FromTOML {})
test_examples(FromToml {})
}
}

View File

@ -4,15 +4,15 @@ use nu_engine::WholeStreamCommand;
use nu_errors::ShellError;
use nu_protocol::Signature;
pub struct FromTSV;
pub struct FromTsv;
#[derive(Deserialize)]
pub struct FromTSVArgs {
pub struct FromTsvArgs {
noheaders: bool,
}
#[async_trait]
impl WholeStreamCommand for FromTSV {
impl WholeStreamCommand for FromTsv {
fn name(&self) -> &str {
"from tsv"
}
@ -36,20 +36,20 @@ impl WholeStreamCommand for FromTSV {
async fn from_tsv(args: CommandArgs) -> Result<OutputStream, ShellError> {
let name = args.call_info.name_tag.clone();
let (FromTSVArgs { noheaders }, input) = args.process().await?;
let (FromTsvArgs { noheaders }, input) = args.process().await?;
from_delimited_data(noheaders, '\t', "TSV", input, name).await
}
#[cfg(test)]
mod tests {
use super::FromTSV;
use super::FromTsv;
use super::ShellError;
#[test]
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
test_examples(FromTSV {})
test_examples(FromTsv {})
}
}

View File

@ -3,10 +3,10 @@ use nu_engine::WholeStreamCommand;
use nu_errors::ShellError;
use nu_protocol::{ReturnSuccess, Signature, TaggedDictBuilder, UntaggedValue};
pub struct FromURL;
pub struct FromUrl;
#[async_trait]
impl WholeStreamCommand for FromURL {
impl WholeStreamCommand for FromUrl {
fn name(&self) -> &str {
"from url"
}
@ -55,13 +55,13 @@ async fn from_url(args: CommandArgs) -> Result<OutputStream, ShellError> {
#[cfg(test)]
mod tests {
use super::FromURL;
use super::FromUrl;
use super::ShellError;
#[test]
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
test_examples(FromURL {})
test_examples(FromUrl {})
}
}

View File

@ -6,15 +6,15 @@ use nu_errors::ShellError;
use nu_protocol::{ReturnSuccess, Signature, TaggedDictBuilder, UntaggedValue};
use std::io::Cursor;
pub struct FromXLSX;
pub struct FromXlsx;
#[derive(Deserialize)]
pub struct FromXLSXArgs {
pub struct FromXlsxArgs {
noheaders: bool,
}
#[async_trait]
impl WholeStreamCommand for FromXLSX {
impl WholeStreamCommand for FromXlsx {
fn name(&self) -> &str {
"from xlsx"
}
@ -40,7 +40,7 @@ async fn from_xlsx(args: CommandArgs) -> Result<OutputStream, ShellError> {
let tag = args.call_info.name_tag.clone();
let span = tag.span;
let (
FromXLSXArgs {
FromXlsxArgs {
noheaders: _noheaders,
},
input,
@ -93,13 +93,13 @@ async fn from_xlsx(args: CommandArgs) -> Result<OutputStream, ShellError> {
#[cfg(test)]
mod tests {
use super::FromXLSX;
use super::FromXlsx;
use super::ShellError;
#[test]
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
test_examples(FromXLSX {})
test_examples(FromXlsx {})
}
}

View File

@ -3,10 +3,10 @@ use nu_engine::WholeStreamCommand;
use nu_errors::ShellError;
use nu_protocol::{Primitive, ReturnSuccess, Signature, TaggedDictBuilder, UntaggedValue, Value};
pub struct FromXML;
pub struct FromXml;
#[async_trait]
impl WholeStreamCommand for FromXML {
impl WholeStreamCommand for FromXml {
fn name(&self) -> &str {
"from xml"
}
@ -298,9 +298,9 @@ mod tests {
#[test]
fn examples_work_as_expected() -> Result<(), ShellError> {
use super::FromXML;
use super::FromXml;
use crate::examples::test as test_examples;
test_examples(FromXML {})
test_examples(FromXml {})
}
}

View File

@ -3,10 +3,10 @@ use nu_engine::WholeStreamCommand;
use nu_errors::ShellError;
use nu_protocol::{Primitive, Signature, TaggedDictBuilder, UntaggedValue, Value};
pub struct FromYAML;
pub struct FromYaml;
#[async_trait]
impl WholeStreamCommand for FromYAML {
impl WholeStreamCommand for FromYaml {
fn name(&self) -> &str {
"from yaml"
}
@ -24,10 +24,10 @@ impl WholeStreamCommand for FromYAML {
}
}
pub struct FromYML;
pub struct FromYml;
#[async_trait]
impl WholeStreamCommand for FromYML {
impl WholeStreamCommand for FromYml {
fn name(&self) -> &str {
"from yml"
}
@ -169,7 +169,7 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
test_examples(FromYAML {})
test_examples(FromYaml {})
}
#[test]

View File

@ -4,16 +4,16 @@ use nu_engine::WholeStreamCommand;
use nu_errors::ShellError;
use nu_protocol::{Primitive, Signature, SyntaxShape, UntaggedValue, Value};
pub struct ToCSV;
pub struct ToCsv;
#[derive(Deserialize)]
pub struct ToCSVArgs {
pub struct ToCsvArgs {
noheaders: bool,
separator: Option<Value>,
}
#[async_trait]
impl WholeStreamCommand for ToCSV {
impl WholeStreamCommand for ToCsv {
fn name(&self) -> &str {
"to csv"
}
@ -45,7 +45,7 @@ impl WholeStreamCommand for ToCSV {
async fn to_csv(args: CommandArgs) -> Result<OutputStream, ShellError> {
let name = args.call_info.name_tag.clone();
let (
ToCSVArgs {
ToCsvArgs {
separator,
noheaders,
},
@ -80,12 +80,12 @@ async fn to_csv(args: CommandArgs) -> Result<OutputStream, ShellError> {
#[cfg(test)]
mod tests {
use super::ShellError;
use super::ToCSV;
use super::ToCsv;
#[test]
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
test_examples(ToCSV {})
test_examples(ToCsv {})
}
}

View File

@ -79,10 +79,10 @@ impl Default for HtmlTheme {
#[folder = "assets/"]
struct Assets;
pub struct ToHTML;
pub struct ToHtml;
#[derive(Deserialize)]
pub struct ToHTMLArgs {
pub struct ToHtmlArgs {
html_color: bool,
no_color: bool,
dark: bool,
@ -92,7 +92,7 @@ pub struct ToHTMLArgs {
}
#[async_trait]
impl WholeStreamCommand for ToHTML {
impl WholeStreamCommand for ToHtml {
fn name(&self) -> &str {
"to html"
}
@ -271,7 +271,7 @@ fn get_list_of_theme_names() -> Vec<String> {
async fn to_html(args: CommandArgs) -> Result<OutputStream, ShellError> {
let name_tag = args.call_info.name_tag.clone();
let (
ToHTMLArgs {
ToHtmlArgs {
html_color,
no_color,
dark,
@ -758,6 +758,6 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
test_examples(ToHTML {})
test_examples(ToHtml {})
}
}

View File

@ -7,15 +7,15 @@ use nu_protocol::{
use serde::Serialize;
use serde_json::json;
pub struct ToJSON;
pub struct ToJson;
#[derive(Deserialize)]
pub struct ToJSONArgs {
pub struct ToJsonArgs {
pretty: Option<Value>,
}
#[async_trait]
impl WholeStreamCommand for ToJSON {
impl WholeStreamCommand for ToJson {
fn name(&self) -> &str {
"to json"
}
@ -160,7 +160,7 @@ fn json_list(input: &[Value]) -> Result<Vec<serde_json::Value>, ShellError> {
async fn to_json(args: CommandArgs) -> Result<OutputStream, ShellError> {
let name_tag = args.call_info.name_tag.clone();
let (ToJSONArgs { pretty }, input) = args.process().await?;
let (ToJsonArgs { pretty }, input) = args.process().await?;
let name_span = name_tag.span;
let input: Vec<Value> = input.collect().await;
@ -256,12 +256,12 @@ async fn to_json(args: CommandArgs) -> Result<OutputStream, ShellError> {
#[cfg(test)]
mod tests {
use super::ShellError;
use super::ToJSON;
use super::ToJson;
#[test]
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
test_examples(ToJSON {})
test_examples(ToJson {})
}
}

View File

@ -3,10 +3,10 @@ use nu_engine::WholeStreamCommand;
use nu_errors::{CoerceInto, ShellError};
use nu_protocol::{Primitive, ReturnSuccess, Signature, UnspannedPathMember, UntaggedValue, Value};
pub struct ToTOML;
pub struct ToToml;
#[async_trait]
impl WholeStreamCommand for ToTOML {
impl WholeStreamCommand for ToToml {
fn name(&self) -> &str {
"to toml"
}
@ -195,7 +195,7 @@ mod tests {
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
test_examples(ToTOML {})
test_examples(ToToml {})
}
#[test]

View File

@ -4,15 +4,15 @@ use nu_engine::WholeStreamCommand;
use nu_errors::ShellError;
use nu_protocol::Signature;
pub struct ToTSV;
pub struct ToTsv;
#[derive(Deserialize)]
pub struct ToTSVArgs {
pub struct ToTsvArgs {
noheaders: bool,
}
#[async_trait]
impl WholeStreamCommand for ToTSV {
impl WholeStreamCommand for ToTsv {
fn name(&self) -> &str {
"to tsv"
}
@ -36,7 +36,7 @@ impl WholeStreamCommand for ToTSV {
async fn to_tsv(args: CommandArgs) -> Result<OutputStream, ShellError> {
let name = args.call_info.name_tag.clone();
let (ToTSVArgs { noheaders }, input) = args.process().await?;
let (ToTsvArgs { noheaders }, input) = args.process().await?;
to_delimited_data(noheaders, '\t', "TSV", input, name).await
}
@ -44,12 +44,12 @@ async fn to_tsv(args: CommandArgs) -> Result<OutputStream, ShellError> {
#[cfg(test)]
mod tests {
use super::ShellError;
use super::ToTSV;
use super::ToTsv;
#[test]
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
test_examples(ToTSV {})
test_examples(ToTsv {})
}
}

View File

@ -3,10 +3,10 @@ use nu_engine::WholeStreamCommand;
use nu_errors::ShellError;
use nu_protocol::{ReturnSuccess, Signature, UntaggedValue, Value};
pub struct ToURL;
pub struct ToUrl;
#[async_trait]
impl WholeStreamCommand for ToURL {
impl WholeStreamCommand for ToUrl {
fn name(&self) -> &str {
"to url"
}
@ -76,12 +76,12 @@ async fn to_url(args: CommandArgs) -> Result<OutputStream, ShellError> {
#[cfg(test)]
mod tests {
use super::ShellError;
use super::ToURL;
use super::ToUrl;
#[test]
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
test_examples(ToURL {})
test_examples(ToUrl {})
}
}

View File

@ -8,15 +8,15 @@ use std::collections::HashSet;
use std::io::Cursor;
use std::io::Write;
pub struct ToXML;
pub struct ToXml;
#[derive(Deserialize)]
pub struct ToXMLArgs {
pub struct ToXmlArgs {
pretty: Option<Value>,
}
#[async_trait]
impl WholeStreamCommand for ToXML {
impl WholeStreamCommand for ToXml {
fn name(&self) -> &str {
"to xml"
}
@ -135,7 +135,7 @@ pub fn write_xml_events<W: Write>(
async fn to_xml(args: CommandArgs) -> Result<OutputStream, ShellError> {
let name_tag = args.call_info.name_tag.clone();
let name_span = name_tag.span;
let (ToXMLArgs { pretty }, input) = args.process().await?;
let (ToXmlArgs { pretty }, input) = args.process().await?;
let input: Vec<Value> = input.collect().await;
let to_process_input = match input.len() {
@ -189,12 +189,12 @@ async fn to_xml(args: CommandArgs) -> Result<OutputStream, ShellError> {
#[cfg(test)]
mod tests {
use super::ShellError;
use super::ToXML;
use super::ToXml;
#[test]
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
test_examples(ToXML {})
test_examples(ToXml {})
}
}

View File

@ -3,10 +3,10 @@ use nu_engine::WholeStreamCommand;
use nu_errors::{CoerceInto, ShellError};
use nu_protocol::{Primitive, ReturnSuccess, Signature, UnspannedPathMember, UntaggedValue, Value};
pub struct ToYAML;
pub struct ToYaml;
#[async_trait]
impl WholeStreamCommand for ToYAML {
impl WholeStreamCommand for ToYaml {
fn name(&self) -> &str {
"to yaml"
}
@ -164,12 +164,12 @@ async fn to_yaml(args: CommandArgs) -> Result<OutputStream, ShellError> {
#[cfg(test)]
mod tests {
use super::ShellError;
use super::ToYAML;
use super::ToYaml;
#[test]
fn examples_work_as_expected() -> Result<(), ShellError> {
use crate::examples::test as test_examples;
test_examples(ToYAML {})
test_examples(ToYaml {})
}
}