Skip to content

Commit e3334af

Browse files
authored
refactor!: set clippy avoid-breaking-exported-api = false (oxc-project#519)
1 parent 20a1c78 commit e3334af

7 files changed

Lines changed: 13 additions & 12 deletions

File tree

.clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
avoid-breaking-exported-api = false

src/cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub trait CachedPath: Sized {
9393
/// Returns a new path by resolving the given subpath (including "." and
9494
/// ".." components) with this path.
9595
#[must_use]
96-
fn normalize_with<C: Cache<Cp = Self>>(&self, subpath: impl AsRef<Path>, cache: &C) -> Self;
96+
fn normalize_with<C: Cache<Cp = Self>, P: AsRef<Path>>(&self, subpath: P, cache: &C) -> Self;
9797

9898
#[must_use]
9999
fn normalize_root<C: Cache<Cp = Self>>(&self, _cache: &C) -> Self;

src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub enum ResolveError {
7070

7171
/// JSON parse error
7272
#[error("{0:?}")]
73-
JSON(JSONError),
73+
Json(JSONError),
7474

7575
/// Restricted by `ResolveOptions::restrictions`
7676
#[error(r#"Path "{0}" restricted by {0}"#)]
@@ -114,7 +114,7 @@ impl ResolveError {
114114
#[must_use]
115115
#[cfg(feature = "fs_cache")]
116116
pub fn from_serde_json_error(path: PathBuf, error: &serde_json::Error) -> Self {
117-
Self::JSON(JSONError {
117+
Self::Json(JSONError {
118118
path,
119119
message: error.to_string(),
120120
line: error.line(),

src/fs_cache.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ impl CachedPath for FsCachedPath {
346346
///
347347
/// # Errors
348348
///
349-
/// * [ResolveError::JSON]
349+
/// * [ResolveError::Json]
350350
fn find_package_json<C: Cache<Cp = Self>>(
351351
&self,
352352
options: &ResolveOptions,
@@ -399,7 +399,7 @@ impl CachedPath for FsCachedPath {
399399
}
400400

401401
/// Returns a new path by resolving the given subpath (including "." and ".." components) with this path.
402-
fn normalize_with<C: Cache<Cp = Self>>(&self, subpath: impl AsRef<Path>, cache: &C) -> Self {
402+
fn normalize_with<C: Cache<Cp = Self>, P: AsRef<Path>>(&self, subpath: P, cache: &C) -> Self {
403403
let subpath = subpath.as_ref();
404404
let mut components = subpath.components();
405405
let Some(head) = components.next() else { return cache.value(subpath) };

src/options.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ impl ResolveOptions {
374374
}
375375

376376
/// Value for [ResolveOptions::enforce_extension]
377-
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
377+
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
378378
pub enum EnforceExtension {
379379
Auto,
380380
Enabled,
@@ -383,17 +383,17 @@ pub enum EnforceExtension {
383383

384384
impl EnforceExtension {
385385
#[must_use]
386-
pub const fn is_auto(&self) -> bool {
386+
pub const fn is_auto(self) -> bool {
387387
matches!(self, Self::Auto)
388388
}
389389

390390
#[must_use]
391-
pub const fn is_enabled(&self) -> bool {
391+
pub const fn is_enabled(self) -> bool {
392392
matches!(self, Self::Enabled)
393393
}
394394

395395
#[must_use]
396-
pub const fn is_disabled(&self) -> bool {
396+
pub const fn is_disabled(self) -> bool {
397397
matches!(self, Self::Disabled)
398398
}
399399
}

src/tests/incorrect_description_file.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn incorrect_description_file_1() {
1010
let f = super::fixture().join("incorrect-package");
1111
let mut ctx = ResolveContext::default();
1212
let resolution = Resolver::default().resolve_with_context(f.join("pack1"), ".", &mut ctx);
13-
let error = ResolveError::JSON(JSONError {
13+
let error = ResolveError::Json(JSONError {
1414
path: f.join("pack1/package.json"),
1515
message: String::from("EOF while parsing a value at line 3 column 0"),
1616
line: 3,
@@ -29,7 +29,7 @@ fn incorrect_description_file_1() {
2929
fn incorrect_description_file_2() {
3030
let f = super::fixture().join("incorrect-package");
3131
let resolution = Resolver::default().resolve(f.join("pack2"), ".");
32-
let error = ResolveError::JSON(JSONError {
32+
let error = ResolveError::Json(JSONError {
3333
path: f.join("pack2/package.json"),
3434
message: String::from("EOF while parsing a value at line 1 column 0"),
3535
line: 1,

src/tests/tsconfig_paths.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ fn broken() {
120120
});
121121

122122
let resolved_path = resolver.resolve(&f, "/");
123-
let error = ResolveError::JSON(JSONError {
123+
let error = ResolveError::Json(JSONError {
124124
path: f.join("tsconfig_broken.json"),
125125
message: String::from("EOF while parsing an object at line 2 column 0"),
126126
line: 2,

0 commit comments

Comments
 (0)