1CARGO-CLEAN(1) CARGO-CLEAN(1)
2
3
4
6 cargo-clean - Remove generated artifacts
7
9 cargo clean [OPTIONS]
10
12 Remove artifacts from the target directory that Cargo has generated in
13 the past.
14
15 With no options, cargo clean will delete the entire target directory.
16
18 Package Selection
19 When no packages are selected, all packages and all dependencies in the
20 workspace are cleaned.
21
22 -p SPEC..., --package SPEC...
23 Clean only the specified packages. This flag may be specified
24 multiple times. See cargo-pkgid(1) for the SPEC format.
25
26 Clean Options
27 --doc
28 This option will cause cargo clean to remove only the doc directory
29 in the target directory.
30
31 --release
32 Clean all artifacts that were built with the release or bench
33 profiles.
34
35 --target-dir DIRECTORY
36 Directory for all generated artifacts and intermediate files. May
37 also be specified with the CARGO_TARGET_DIR environment variable,
38 or the build.target-dir config value
39 <https://doc.rust-lang.org/cargo/reference/config.html>. Defaults
40 to target in the root of the workspace.
41
42 --target TRIPLE
43 Clean for the given architecture. The default is the host
44 architecture. The general format of the triple is
45 <arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
46 a list of supported targets.
47
48 This may also be specified with the build.target config value
49 <https://doc.rust-lang.org/cargo/reference/config.html>.
50
51 Display Options
52 -v, --verbose
53 Use verbose output. May be specified twice for "very verbose"
54 output which includes extra output such as dependency warnings and
55 build script output. May also be specified with the term.verbose
56 config value
57 <https://doc.rust-lang.org/cargo/reference/config.html>.
58
59 -q, --quiet
60 No output printed to stdout.
61
62 --color WHEN
63 Control when colored output is used. Valid values:
64
65 · auto (default): Automatically detect if color support is
66 available on the terminal.
67
68 · always: Always display colors.
69
70 · never: Never display colors.
71
72 May also be specified with the term.color config value
73 <https://doc.rust-lang.org/cargo/reference/config.html>.
74
75 Manifest Options
76 --manifest-path PATH
77 Path to the Cargo.toml file. By default, Cargo searches in the
78 current directory or any parent directory for the Cargo.toml file.
79
80 --frozen, --locked
81 Either of these flags requires that the Cargo.lock file is
82 up-to-date. If the lock file is missing, or it needs to be updated,
83 Cargo will exit with an error. The --frozen flag also prevents
84 Cargo from attempting to access the network to determine if it is
85 out-of-date.
86
87 These may be used in environments where you want to assert that the
88 Cargo.lock file is up-to-date (such as a CI build) or want to avoid
89 network access.
90
91 Common Options
92 -h, --help
93 Prints help information.
94
95 -Z FLAG...
96 Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
97 details.
98
100 See the reference
101 <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
102 for details on environment variables that Cargo reads.
103
105 0
106 Cargo succeeded.
107
108 101
109 Cargo failed to complete.
110
112 1. Remove the entire target directory:
113
114 cargo clean
115
116 2. Remove only the release artifacts:
117
118 cargo clean --release
119
121 cargo(1), cargo-build(1)
122
123
124
125 2018-12-20 CARGO-CLEAN(1)