1CARGO-CLEAN(1)                                                  CARGO-CLEAN(1)
2
3
4

NAME

6       cargo-clean - Remove generated artifacts
7

SYNOPSIS

9       cargo clean [OPTIONS]
10

DESCRIPTION

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

OPTIONS

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       --offline
92           Prevents Cargo from accessing the network for any reason. Without
93           this flag, Cargo will stop with an error if it needs to access the
94           network and the network is not available. With this flag, Cargo
95           will attempt to proceed without the network if possible.
96
97           Beware that this may result in different dependency resolution than
98           online mode. Cargo will restrict itself to crates that are
99           downloaded locally, even if there might be a newer version as
100           indicated in the local copy of the index. See the cargo-fetch(1)
101           command to download dependencies before going offline.
102
103           May also be specified with the net.offline config value
104           <https://doc.rust-lang.org/cargo/reference/config.html>.
105
106   Common Options
107       -h, --help
108           Prints help information.
109
110       -Z FLAG...
111           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
112           details.
113

ENVIRONMENT

115       See the reference
116       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
117       for details on environment variables that Cargo reads.
118

EXIT STATUS

120       0
121           Cargo succeeded.
122
123       101
124           Cargo failed to complete.
125

EXAMPLES

127        1. Remove the entire target directory:
128
129               cargo clean
130
131        2. Remove only the release artifacts:
132
133               cargo clean --release
134

SEE ALSO

136       cargo(1), cargo-build(1)
137
138
139
140                                  2019-06-07                    CARGO-CLEAN(1)
Impressum