Skip to content

Commit 2604767

Browse files
Remove deprecated access patterns on Config struct (#922)
Remove deprecated access patterns
1 parent d11797b commit 2604767

File tree

2 files changed

+1
-187
lines changed

2 files changed

+1
-187
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- For automated downloaders: the legacy release artifacts `stylua-win64.zip`, `stylua-linux.zip` and `stylua-macos.zip` are no longer produced in GitHub releases, in favour of more specific names (e.g., `stylua-windows-x86_64`, `stylua-linux-x86_64` and `stylua-macos-x86_64`).
1313
- `--stdin-filepath` no longer respects ignore files by default, in line with passing files directly to the command line. Now, `stylua --stdin-filepath foo.lua -` will still format the stdin even if `foo.lua` was in a `.styluaignore` file. Use `--respect-ignores` to preserve the original behaviour.
14+
- Removed deprecated access patterns on `Config` struct in stylua Rust library
1415

1516
### Added
1617

src/lib.rs

Lines changed: 0 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -260,151 +260,6 @@ impl Config {
260260
pub fn new() -> Self {
261261
Config::default()
262262
}
263-
264-
/// Returns the current configured column width
265-
#[deprecated(since = "0.19.0", note = "access `.column_width` directly instead")]
266-
#[cfg(not(all(target_arch = "wasm32", feature = "wasm-bindgen")))]
267-
pub fn column_width(&self) -> usize {
268-
self.column_width
269-
}
270-
271-
/// Returns the current configured line endings
272-
#[deprecated(since = "0.19.0", note = "access `.line_endings` directly instead")]
273-
#[cfg(not(all(target_arch = "wasm32", feature = "wasm-bindgen")))]
274-
pub fn line_endings(&self) -> LineEndings {
275-
self.line_endings
276-
}
277-
278-
/// Returns the current configured indent type
279-
#[deprecated(since = "0.19.0", note = "access `.indent_type` directly instead")]
280-
#[cfg(not(all(target_arch = "wasm32", feature = "wasm-bindgen")))]
281-
pub fn indent_type(&self) -> IndentType {
282-
self.indent_type
283-
}
284-
285-
/// Returns the current configured indent width
286-
#[deprecated(since = "0.19.0", note = "access `.indent_width` directly instead")]
287-
#[cfg(not(all(target_arch = "wasm32", feature = "wasm-bindgen")))]
288-
pub fn indent_width(&self) -> usize {
289-
self.indent_width
290-
}
291-
292-
/// Returns the current configured quote style
293-
#[deprecated(since = "0.19.0", note = "access `.quote_style` directly instead")]
294-
#[cfg(not(all(target_arch = "wasm32", feature = "wasm-bindgen")))]
295-
pub fn quote_style(&self) -> QuoteStyle {
296-
self.quote_style
297-
}
298-
299-
/// Returns the current configured call parentheses style
300-
#[deprecated(since = "0.19.0", note = "access `.call_parentheses` directly instead")]
301-
#[cfg(not(all(target_arch = "wasm32", feature = "wasm-bindgen")))]
302-
pub fn call_parentheses(&self) -> CallParenType {
303-
self.call_parentheses
304-
}
305-
306-
#[deprecated(
307-
since = "0.19.0",
308-
note = "access `.collapse_simple_statement` directly instead"
309-
)]
310-
#[cfg(not(all(target_arch = "wasm32", feature = "wasm-bindgen")))]
311-
pub fn collapse_simple_statement(&self) -> CollapseSimpleStatement {
312-
self.collapse_simple_statement
313-
}
314-
315-
/// Returns the current sort requires codemod configuration
316-
#[deprecated(since = "0.19.0", note = "access `.sort_requires` directly instead")]
317-
#[cfg(not(all(target_arch = "wasm32", feature = "wasm-bindgen")))]
318-
pub fn sort_requires(&self) -> SortRequiresConfig {
319-
self.sort_requires
320-
}
321-
322-
/// Returns a new config with the given column width
323-
#[deprecated(since = "0.19.0", note = "modify `.column_width` directly instead")]
324-
pub fn with_column_width(self, column_width: usize) -> Self {
325-
Self {
326-
column_width,
327-
..self
328-
}
329-
}
330-
331-
/// Returns a new config with the given line endings
332-
#[deprecated(since = "0.19.0", note = "modify `.line_endings` directly instead")]
333-
pub fn with_line_endings(self, line_endings: LineEndings) -> Self {
334-
Self {
335-
line_endings,
336-
..self
337-
}
338-
}
339-
340-
/// Returns a new config with the given indent type
341-
#[deprecated(since = "0.19.0", note = "modify `.indent_type` directly instead")]
342-
pub fn with_indent_type(self, indent_type: IndentType) -> Self {
343-
Self {
344-
indent_type,
345-
..self
346-
}
347-
}
348-
349-
/// Returns a new config with the given indent width
350-
#[deprecated(since = "0.19.0", note = "modify `.indent_width` directly instead")]
351-
pub fn with_indent_width(self, indent_width: usize) -> Self {
352-
Self {
353-
indent_width,
354-
..self
355-
}
356-
}
357-
358-
/// Returns a new config with the given quote style
359-
#[deprecated(since = "0.19.0", note = "modify `.quote_style` directly instead")]
360-
pub fn with_quote_style(self, quote_style: QuoteStyle) -> Self {
361-
Self {
362-
quote_style,
363-
..self
364-
}
365-
}
366-
367-
/// Returns a new config with the given value for `no_call_parentheses`
368-
#[deprecated(note = "use `call_parentheses")]
369-
pub fn with_no_call_parentheses(self, no_call_parentheses: bool) -> Self {
370-
#[allow(deprecated)]
371-
Self {
372-
no_call_parentheses,
373-
..self
374-
}
375-
}
376-
377-
/// Returns a new config with the given call parentheses type
378-
#[deprecated(since = "0.19.0", note = "modify `.call_parentheses` directly instead")]
379-
pub fn with_call_parentheses(self, call_parentheses: CallParenType) -> Self {
380-
Self {
381-
call_parentheses,
382-
..self
383-
}
384-
}
385-
386-
#[deprecated(
387-
since = "0.19.0",
388-
note = "modify `.collapse_simple_statement` directly instead"
389-
)]
390-
pub fn with_collapse_simple_statement(
391-
self,
392-
collapse_simple_statement: CollapseSimpleStatement,
393-
) -> Self {
394-
Self {
395-
collapse_simple_statement,
396-
..self
397-
}
398-
}
399-
400-
/// Returns a new config with the given sort requires configuration
401-
#[deprecated(since = "0.19.0", note = "modify `.sort_requires` directly instead")]
402-
pub fn with_sort_requires(self, sort_requires: SortRequiresConfig) -> Self {
403-
Self {
404-
sort_requires,
405-
..self
406-
}
407-
}
408263
}
409264

410265
impl Default for Config {
@@ -592,46 +447,4 @@ mod tests {
592447
.unwrap();
593448
assert_eq!(output, "local x = 1\n");
594449
}
595-
596-
#[test]
597-
#[allow(deprecated)]
598-
fn test_config_column_width() {
599-
let new_config = Config::new().with_column_width(80);
600-
assert_eq!(new_config.column_width(), 80);
601-
}
602-
603-
#[test]
604-
#[allow(deprecated)]
605-
fn test_config_line_endings() {
606-
let new_config = Config::new().with_line_endings(LineEndings::Windows);
607-
assert_eq!(new_config.line_endings(), LineEndings::Windows);
608-
}
609-
610-
#[test]
611-
#[allow(deprecated)]
612-
fn test_config_indent_type() {
613-
let new_config = Config::new().with_indent_type(IndentType::Spaces);
614-
assert_eq!(new_config.indent_type(), IndentType::Spaces);
615-
}
616-
617-
#[test]
618-
#[allow(deprecated)]
619-
fn test_config_indent_width() {
620-
let new_config = Config::new().with_indent_width(2);
621-
assert_eq!(new_config.indent_width(), 2);
622-
}
623-
624-
#[test]
625-
#[allow(deprecated)]
626-
fn test_config_quote_style() {
627-
let new_config = Config::new().with_quote_style(QuoteStyle::ForceDouble);
628-
assert_eq!(new_config.quote_style(), QuoteStyle::ForceDouble);
629-
}
630-
631-
#[test]
632-
#[allow(deprecated)]
633-
fn test_config_call_parentheses() {
634-
let new_config = Config::new().with_call_parentheses(CallParenType::None);
635-
assert_eq!(new_config.call_parentheses(), CallParenType::None);
636-
}
637450
}

0 commit comments

Comments
 (0)