fix: fix some nightly warnings

This commit is contained in:
Boshen 2024-05-19 00:54:52 +08:00
parent 0742081921
commit 899a52bf28
No known key found for this signature in database
GPG key ID: 9C7A8C8AB22BEBD1
5 changed files with 16 additions and 27 deletions

View file

@ -1727,7 +1727,7 @@ pub struct UsingDeclaration<'a> {
#[cfg_attr(feature = "serialize", serde(flatten))] #[cfg_attr(feature = "serialize", serde(flatten))]
pub span: Span, pub span: Span,
pub is_await: bool, pub is_await: bool,
#[cfg_attr(feature = "serde-impl", serde(default))] #[cfg_attr(feature = "serialize", serde(default))]
pub declarations: Vec<'a, VariableDeclarator<'a>>, pub declarations: Vec<'a, VariableDeclarator<'a>>,
} }

View file

@ -1,5 +1,4 @@
mod linter; mod linter;
mod options;
use crate::linter::{DiagnosticReport, ServerLinter}; use crate::linter::{DiagnosticReport, ServerLinter};
use globset::Glob; use globset::Glob;

View file

@ -1,10 +0,0 @@
use std::path::PathBuf;
#[derive(Debug, Default)]
pub struct LintOptions {
pub paths: Vec<PathBuf>,
pub fix: bool,
pub ignore_path: PathBuf,
pub no_ignore: bool,
pub ignore_pattern: Vec<String>,
}

View file

@ -4,7 +4,7 @@ use crate::error::{Error, Result};
/// - Quote `source_content` at parallel. /// - Quote `source_content` at parallel.
/// - If you using `ConcatSourceMapBuilder`, serialize `tokens` to vlq `mappings` at parallel. /// - If you using `ConcatSourceMapBuilder`, serialize `tokens` to vlq `mappings` at parallel.
use crate::{token::TokenChunk, SourceMap, Token}; use crate::{token::TokenChunk, SourceMap, Token};
#[cfg(feature = "rayon")] #[cfg(feature = "concurrent")]
use rayon::prelude::*; use rayon::prelude::*;
// Here using `serde_json::to_string` to serialization `names/source_contents/sources`. // Here using `serde_json::to_string` to serialization `names/source_contents/sources`.
@ -42,7 +42,7 @@ pub fn encode(sourcemap: &SourceMap) -> Result<String> {
if let Some(source_contents) = &sourcemap.source_contents { if let Some(source_contents) = &sourcemap.source_contents {
buf.push_str("],\"sourcesContent\":["); buf.push_str("],\"sourcesContent\":[");
cfg_if::cfg_if! { cfg_if::cfg_if! {
if #[cfg(feature = "rayon")] { if #[cfg(feature = "concurrent")] {
let quote_source_contents = source_contents let quote_source_contents = source_contents
.par_iter() .par_iter()
.map(|x| serde_json::to_string(x.as_ref())) .map(|x| serde_json::to_string(x.as_ref()))
@ -82,7 +82,7 @@ fn serialize_sourcemap_mappings(sm: &SourceMap) -> String {
|token_chunks| { |token_chunks| {
// Serialize `tokens` to vlq `mappings` at parallel. // Serialize `tokens` to vlq `mappings` at parallel.
cfg_if::cfg_if! { cfg_if::cfg_if! {
if #[cfg(feature = "rayon")] { if #[cfg(feature = "concurrent")] {
token_chunks token_chunks
.par_iter() .par_iter()
.map(|token_chunk| serialize_mappings(&sm.tokens, token_chunk)) .map(|token_chunk| serialize_mappings(&sm.tokens, token_chunk))

View file

@ -2,16 +2,16 @@ use saphyr::{Yaml, YamlLoader};
#[derive(Debug, Clone, Default)] #[derive(Debug, Clone, Default)]
pub struct MetaData { pub struct MetaData {
pub description: Box<str>, // pub description: Box<str>,
pub esid: Option<Box<str>>, // pub esid: Option<Box<str>>,
pub es5id: Option<Box<str>>, // pub es5id: Option<Box<str>>,
pub es6id: Option<Box<str>>, // pub es6id: Option<Box<str>>,
pub info: Box<str>, // pub info: Box<str>,
pub features: Box<[Box<str>]>, pub features: Box<[Box<str>]>,
pub includes: Box<[Box<str>]>, pub includes: Box<[Box<str>]>,
pub flags: Box<[TestFlag]>, pub flags: Box<[TestFlag]>,
pub negative: Option<Negative>, pub negative: Option<Negative>,
pub locale: Box<[Box<str>]>, // pub locale: Box<[Box<str>]>,
} }
/// Individual test flag. /// Individual test flag.
@ -90,11 +90,11 @@ impl MetaData {
let yamls = YamlLoader::load_from_str(s).unwrap_or_default(); let yamls = YamlLoader::load_from_str(s).unwrap_or_default();
let Some(yaml) = yamls.first() else { return Self::default() }; let Some(yaml) = yamls.first() else { return Self::default() };
Self { Self {
description: yaml["description"].as_str().unwrap_or_default().into(), // description: yaml["description"].as_str().unwrap_or_default().into(),
esid: yaml["esid"].as_str().map(Into::into), // esid: yaml["esid"].as_str().map(Into::into),
es5id: yaml["es5id"].as_str().map(Into::into), // es5id: yaml["es5id"].as_str().map(Into::into),
es6id: yaml["es6id"].as_str().map(Into::into), // es6id: yaml["es6id"].as_str().map(Into::into),
info: yaml["info"].as_str().unwrap_or_default().into(), // info: yaml["info"].as_str().unwrap_or_default().into(),
features: Self::get_vec_of_string(&yaml["features"]), features: Self::get_vec_of_string(&yaml["features"]),
includes: Self::get_vec_of_string(&yaml["includes"]), includes: Self::get_vec_of_string(&yaml["includes"]),
flags: yaml["flags"] flags: yaml["flags"]
@ -109,7 +109,7 @@ impl MetaData {
let yaml = &yaml["negative"]; let yaml = &yaml["negative"];
(!yaml.is_null() && !yaml.is_badvalue()).then(|| Negative::from_yaml(yaml)) (!yaml.is_null() && !yaml.is_badvalue()).then(|| Negative::from_yaml(yaml))
}, },
locale: Self::get_vec_of_string(&yaml["locale"]), // locale: Self::get_vec_of_string(&yaml["locale"]),
} }
} }