mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
refactor(rust): remove some #[allow(unused)] (#5716)
This commit is contained in:
parent
c3dd2a048d
commit
4bdc202325
11 changed files with 6 additions and 18 deletions
|
|
@ -166,8 +166,8 @@ pub struct IfBreak<'a> {
|
|||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
#[allow(unused)]
|
||||
pub enum Separator {
|
||||
#[allow(unused)]
|
||||
Softline,
|
||||
Hardline,
|
||||
CommaLine, // [",", line]
|
||||
|
|
@ -196,7 +196,6 @@ pub trait DocBuilder<'a> {
|
|||
Box::new_in(doc, self.allocator())
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
fn join(&self, separator: Separator, docs: std::vec::Vec<Doc<'a>>) -> Vec<'a, Doc<'a>> {
|
||||
let mut parts = self.vec();
|
||||
for (i, doc) in docs.into_iter().enumerate() {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use oxc_ast::{ast::*, AstKind};
|
||||
use oxc_span::Span;
|
||||
|
||||
use crate::{array, doc::Doc, indent, line, space, ss, Prettier};
|
||||
use crate::{array, doc::Doc, indent, line, space, ss, DocBuilder, Prettier};
|
||||
|
||||
pub(super) fn adjust_clause<'a>(
|
||||
p: &Prettier<'a>,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use oxc_ast::ast::*;
|
||||
|
||||
use crate::{doc::Doc, group, indent, line, ss, Format, Prettier};
|
||||
use crate::{doc::Doc, group, indent, line, ss, DocBuilder, Format, Prettier};
|
||||
|
||||
pub(super) fn print_ternary<'a>(p: &mut Prettier<'a>, expr: &ConditionalExpression<'a>) -> Doc<'a> {
|
||||
group![
|
||||
|
|
|
|||
|
|
@ -145,7 +145,6 @@ impl<'a> Prettier<'a> {
|
|||
self.should_print_comma_impl(false)
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
fn should_print_all_comma(&self) -> bool {
|
||||
self.should_print_comma_impl(true)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ macro_rules! string {
|
|||
macro_rules! indent {
|
||||
($p:ident, $( $x:expr ),* $(,)?) => {
|
||||
{
|
||||
use $crate::doc::DocBuilder;
|
||||
let mut temp_vec = $p.vec();
|
||||
$(
|
||||
temp_vec.push($x);
|
||||
|
|
@ -81,7 +80,6 @@ macro_rules! hardline {
|
|||
macro_rules! array {
|
||||
($p:ident, $( $x:expr ),* $(,)?) => {
|
||||
{
|
||||
use $crate::doc::DocBuilder;
|
||||
let mut temp_vec = $p.vec();
|
||||
$(
|
||||
temp_vec.push($x);
|
||||
|
|
@ -95,7 +93,6 @@ macro_rules! array {
|
|||
macro_rules! group {
|
||||
($p:ident, $( $x:expr ),* $(,)?) => {
|
||||
{
|
||||
use $crate::doc::DocBuilder;
|
||||
let mut temp_vec = $p.vec();
|
||||
$(
|
||||
temp_vec.push($x);
|
||||
|
|
@ -109,7 +106,6 @@ macro_rules! group {
|
|||
macro_rules! conditional_group {
|
||||
($p:ident, $c: expr, $( $x:expr ),* $(,)?) => {
|
||||
{
|
||||
use $crate::doc::DocBuilder;
|
||||
let mut temp_vec = $p.vec();
|
||||
$(
|
||||
temp_vec.push($x);
|
||||
|
|
@ -124,7 +120,6 @@ macro_rules! conditional_group {
|
|||
macro_rules! group_break {
|
||||
($p:ident, $( $x:expr ),* $(,)?) => {
|
||||
{
|
||||
use $crate::doc::DocBuilder;
|
||||
let mut temp_vec = $p.vec();
|
||||
$(
|
||||
temp_vec.push($x);
|
||||
|
|
@ -137,7 +132,7 @@ macro_rules! group_break {
|
|||
#[macro_export]
|
||||
macro_rules! if_break {
|
||||
($p:ident, $s:expr, $flat:expr, $group_id:expr) => {{
|
||||
use $crate::doc::{DocBuilder, IfBreak};
|
||||
use $crate::doc::IfBreak;
|
||||
Doc::IfBreak(IfBreak {
|
||||
break_contents: $p.boxed(Doc::Str($s)),
|
||||
flat_content: $p.boxed(Doc::Str($flat)),
|
||||
|
|
@ -156,7 +151,6 @@ macro_rules! if_break {
|
|||
macro_rules! line_suffix {
|
||||
($p:ident, $( $x:expr ),* $(,)?) => {
|
||||
{
|
||||
use $crate::doc::DocBuilder;
|
||||
let mut temp_vec = $p.vec();
|
||||
$(
|
||||
temp_vec.push($x);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use oxc_syntax::{
|
|||
precedence::GetPrecedence,
|
||||
};
|
||||
|
||||
use crate::{array, binaryish::BinaryishOperator, doc::Doc, ss, Prettier};
|
||||
use crate::{array, binaryish::BinaryishOperator, doc::Doc, ss, DocBuilder, Prettier};
|
||||
|
||||
impl<'a> Prettier<'a> {
|
||||
pub(crate) fn wrap_parens(&mut self, doc: Doc<'a>, kind: AstKind<'a>) -> Doc<'a> {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ impl Counts {
|
|||
counts
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
pub fn assert_accurate(actual: &Self, estimated: &Self) {
|
||||
assert_eq!(actual.nodes, estimated.nodes, "nodes count mismatch");
|
||||
assert_eq!(actual.scopes, estimated.scopes, "scopes count mismatch");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
pub trait Expect<P, R> {
|
||||
#[allow(unused)]
|
||||
#[must_use]
|
||||
fn expect<F>(self, expectation: F) -> Self
|
||||
where
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ use super::{version::Version, Versions};
|
|||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Targets {
|
||||
Query(Query),
|
||||
#[allow(unused)]
|
||||
EsModules(EsModules),
|
||||
Versions(Versions),
|
||||
HashMap(FxHashMap<String, QueryOrVersion>),
|
||||
|
|
|
|||
|
|
@ -106,7 +106,6 @@ impl<'a> BoundIdentifier<'a> {
|
|||
}
|
||||
|
||||
/// Create `IdentifierReference` referencing this binding, which is written to, with specified `Span`
|
||||
#[allow(unused)]
|
||||
pub fn create_spanned_write_reference(
|
||||
&self,
|
||||
span: Span,
|
||||
|
|
@ -127,7 +126,6 @@ impl<'a> BoundIdentifier<'a> {
|
|||
|
||||
/// Create `IdentifierReference` referencing this binding, which is read from + written to,
|
||||
/// with specified `Span`
|
||||
#[allow(unused)]
|
||||
pub fn create_spanned_read_write_reference(
|
||||
&self,
|
||||
span: Span,
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ use crate::context::Ctx;
|
|||
///
|
||||
/// In: `const x: number = 0;`
|
||||
/// Out: `const x = 0;`
|
||||
#[allow(unused)]
|
||||
pub struct TypeScript<'a> {
|
||||
options: Rc<TypeScriptOptions>,
|
||||
ctx: Ctx<'a>,
|
||||
|
|
|
|||
Loading…
Reference in a new issue